# UsdRelationship with time samples causes Parsing Error

**URL:** https://forum.aousd.org/t/usdrelationship-with-time-samples-causes-parsing-error/2185
**Category:** USD
**Tags:** cpp, python
**Created:** [January 29, 2025, 5:12pm UTC](https://forum.aousd.org/t/usdrelationship-with-time-samples-causes-parsing-error/2185 "2025-01-29T17:12:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![miguelh](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@miguelh](https://forum.aousd.org/u/miguelh)
#### Post date: [January 29, 2025, 5:12pm UTC](https://forum.aousd.org/t/usdrelationship-with-time-samples-causes-parsing-error/2185/1 "2025-01-29T17:12:43Z")

</div>

Hi,  
Using OpenUSD 24.11, I found that the following usda cannot be parsed. I understand that UsdRelationships are always uniform, as such I suppose, having a single timestamp should be a correct input, however the following:

```usda
#usda 1.0

def "prim" (
)
{
    rel singleTimesampleWithDefault = </prim/child>
    rel singleTimesampleWithDefault.timeSamples = {
        1.0: </prim/child>
    }

    def "child" {
    }
}

```

with any number of timestamps (none, 1 or more than 1), leads to:

```shell
pxr.Tf.ErrorException: 
	Error in 'pxrInternal_v0_24_11 __pxrReserved__ ::Sdf_TextFileFormatParser::_RaiseErrorPEGTL' at line 48 in file D:/a/OpenUSD/OpenUSD/pxr/usd/sdf/textParserHelpers.h : 'C:\sources\test-core\test.usda:7:37: parse error matching struct PXR_INTERNAL_NS_pegtl::sor<struct PXR_INTERNAL_NS_pegtl::if_must<struct pxrInternal_v0_24_11 __pxrReserved__ ::Sdf_TextFileFormatParser::KeywordDefault,struct PXR_INTERNAL_NS_pegtl::seq<struct pxrInternal_v0_24_11 __pxrReserved__ ::Sdf_TextFileFormatParser::Assignment,struct pxrInternal_v0_24_11 __pxrReserved__ ::Sdf_TextFileFormatParser::PathRef> > > at 'timeSamples = {' in </prim.singleTimesampleWithDefault>
'
	Error in 'pxrInternal_v0_24_11 __pxrReserved__ ::UsdStage::Open' at line 1052 in file D:\a\OpenUSD\OpenUSD\pxr\usd\usd\stage.cpp : 'Failed to open layer @C:\sources\test-parsing\test-relationship.usda@'

```

This was working in previous versions. Is this expected?

---

<div class="post-metadata">

### Author: ![miguelh](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@miguelh](https://forum.aousd.org/u/miguelh)
#### Post date: [January 29, 2025, 5:22pm UTC](https://forum.aousd.org/t/usdrelationship-with-time-samples-causes-parsing-error/2185/2 "2025-01-29T17:22:39Z")

</div>

Just to make sure what the concern is here:

- This likely being caused by the 24.11 PEGTL parser rewrite
- It’s **not** something we rely on, but something we were checking for to ensure that it did **not** happen.

---

<div class="post-metadata">

### Author: ![spiff](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/spiff/32/22_2.png) [@spiff](https://forum.aousd.org/u/spiff)
#### Post date: [January 30, 2025, 10:49pm UTC](https://forum.aousd.org/t/usdrelationship-with-time-samples-causes-parsing-error/2185/3 "2025-01-30T22:49:07Z")

</div>

Hi @miguelh ,

That should indeed be a parse error… the old parser, and some factoring of the Sdf API’s (like `SetDefault` and other attribute-related functionality) appearing on SdfPropertySpec, shared by both relationships and attributes. The reason for this is that these low-level libraries originated in Presto, where we decided to imbue relationships with an “alter ego” that completely changed their meaning and functionality when we declared them to be “varying”.

We do not ever intend to support varying relationships in USD, and we now have alternative tools to address the problems we faced in Presto twenty years ago - which _will_ be of concern for OpenUSD also (i.e. constraints) in the coming years.

Hope it doesn’t cause too many problems for you, because it is a desired behavior change.
