{"record":{"id":"64059783a0ce9c2e","repo":"Humanizr/Humanizer","slug":"path-contains-a-samerenderedas-cycle-at-node","errorCode":null,"errorMessage":"'{path}' contains a sameRenderedAs cycle at '{node}'.","messagePattern":"'(.+?)' contains a sameRenderedAs cycle at '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs","lineNumber":974,"sourceCode":"            string caseName,\n            string unitName,\n            ImmutableArray<string> inventory,\n            ImmutableDictionary<string, DurationCaseRealization> realizations,\n            HashSet<string> resolving,\n            string path,\n            bool aliasing)\n        {\n            if (!inventory.Contains(caseName, StringComparer.Ordinal) ||\n                !realizations.TryGetValue(caseName, out var realization))\n            {\n                throw new InvalidOperationException(\n                    $\"'{path}' references absent case '{caseName}'.\");\n            }\n\n            var node = $\"{caseName}/{unitName}\";\n            if (!resolving.Add(node))\n            {\n                throw new InvalidOperationException(\n                    $\"'{path}' contains a sameRenderedAs cycle at '{node}'.\");\n            }\n\n            DurationCaseUnit result;\n            switch (realization.Kind)\n            {\n                case DurationCaseRealizationKind.Authored:\n                    if (realization.Units.IsEmpty)\n                    {\n                        result = new DurationCaseUnit(DurationCaseUnitKind.SameAsNominative, null);\n                        break;\n                    }\n\n                    var unit = realization.Units[unitName];\n                    result = unit.Kind switch\n                    {\n                        DurationCaseRealizationKind.Authored =>\n                            new DurationCaseUnit(DurationCaseUnitKind.Phrase, unit.Phrase),","sourceCodeStart":956,"sourceCodeEnd":992,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs#L956-L992","documentation":"Thrown by ResolveUnit when following a chain of sameRenderedAs references creates a cycle. The resolver maintains a HashSet of visited case/unit nodes (formatted as caseName/unitName) and throws when it cannot add a node because it was already in the resolving set.","triggerScenarios":"Case A's sameRenderedAs points to Case B, and Case B's sameRenderedAs points back to Case A (directly or through a longer chain), so the recursive resolution revisits a node already in the resolving set.","commonSituations":"A contributor sets up a group of cases to alias each other and accidentally creates a circular reference (e.g. dative -> accusative -> dative). Also occurs when a case is supposed to alias nominative but is itself aliased by nominative.","solutions":["Trace the sameRenderedAs chain starting from the node reported in the error.","Break the cycle by ensuring at least one case in the chain resolves to an authored realization (phrase, notApplicable, or unsupported) rather than another sameRenderedAs.","Rebuild to confirm the resolver terminates."],"exampleFix":"# before (cycle: accusative -> dative -> accusative)\naccusative:\n  sameRenderedAs: dative\ndative:\n  sameRenderedAs: accusative\n# after\naccusative:\n  sameRenderedAs: nominative\ndative:\n  sameRenderedAs: nominative","handlingStrategy":"validation","validationCode":"# Detect sameRenderedAs cycles via graph traversal before building\n# python: build a directed graph of case -> sameRenderedAs target, detect cycles with DFS","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure every sameRenderedAs chain eventually terminates at an authored case (one with a phrase, notApplicable, or unsupported).","Draw the alias graph on paper before encoding it in YAML.","Prefer aliasing to nominative (the citation case) as the common terminal to avoid accidental cycles."],"tags":["humanizer","locale","yaml","source-generator","duration-cases","cycle","case-reference","build-time"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}