{"record":{"id":"5a1bb0b232cef987","repo":"Humanizr/Humanizer","slug":"path-sameasnominative-must-be-true","errorCode":null,"errorMessage":"'{path}.sameAsNominative' must be true.","messagePattern":"'(.+?)\\.sameAsNominative' must be true\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs","lineNumber":1161,"sourceCode":"\n            return new DurationCaseOverlay(units.ToImmutable());\n        }\n\n        static DurationCaseUnit ParseUnit(SimpleYamlValue value, string path)\n        {\n            if (ContainsInheritanceMarker(value))\n            {\n                throw new InvalidOperationException(\n                    $\"'{path}' contains an unresolved CLDR inheritance marker.\");\n            }\n\n            var mapping = ExpectMapping(value, path);\n            if (mapping.GetScalar(\"sameAsNominative\") is { } sameAsNominative)\n            {\n                RejectUnknownKeys(mapping, path, [\"sameAsNominative\"]);\n                if (!bool.TryParse(sameAsNominative, out var enabled) || !enabled)\n                {\n                    throw new InvalidOperationException($\"'{path}.sameAsNominative' must be true.\");\n                }\n\n                return new DurationCaseUnit(DurationCaseUnitKind.SameAsNominative, null);\n            }\n\n            if (mapping.GetScalar(\"unsupported\") is { } unsupported)\n            {\n                RejectUnknownKeys(mapping, path, [\"unsupported\"]);\n                if (!bool.TryParse(unsupported, out var enabled) || !enabled)\n                {\n                    throw new InvalidOperationException($\"'{path}.unsupported' must be true.\");\n                }\n\n                return new DurationCaseUnit(DurationCaseUnitKind.Unsupported, null);\n            }\n\n            var phrase = LocalePhraseNormalization.ParseTimeSpanPhrase(value, path);\n            if (phrase.Single is null ||","sourceCodeStart":1143,"sourceCodeEnd":1179,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs#L1143-L1179","documentation":"When a duration-case unit declares 'sameAsNominative', ParseUnit (DurationCaseModels.cs:1159-1162) requires the value to be exactly boolean true. The schema has no false branch: a unit either is identical to the nominative (true) or it carries a full phrase. Any other value (false, \"yes\", 1, a non-boolean string) fails bool.TryParse or the enabled check.","triggerScenarios":"sameAsNominative is set to false, to a quoted string like \"yes\"/\"true\", or to a non-boolean scalar.","commonSituations":"A contributor writes 'sameAsNominative: false' meaning 'not the same' — but the correct action is to remove the key and author a phrase; or a typo from copy-paste.","solutions":["If the unit really equals the nominative form, set 'sameAsNominative: true' (unquoted YAML boolean).","If it differs, delete the sameAsNominative key and author a full phrase: block (single + multiple.forms).","Ensure the value is a plain YAML boolean, not a quoted string."],"exampleFix":"# before\nmillisecond:\n  sameAsNominative: false\n# after - unit differs from nominative\nmillisecond:\n  phrase:\n    single: { numeric: '1 millisekunda', words: 'jedna millisekunda' }\n    multiple:\n      forms: { default: 'millisekund' }","handlingStrategy":"validation","validationCode":"# A sameAsNominative unit must be exactly true\nforeach ($u in $caseUnits.GetEnumerator()) {\n    if ($u.Value -is [hashtable] -and $u.Value.ContainsKey('sameAsNominative') `\n        -and $u.Value.sameAsNominative -ne $true) {\n        throw \"unit '$($u.Key)': sameAsNominative must be true (got $($u.Value.sameAsNominative))\"\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the schema has no false branch: if a unit differs, remove the key and author a phrase.","Use plain YAML booleans, not quoted strings.","Treat sameAsNominative and unsupported as mutually exclusive."],"tags":["source-generator","build-time","localization","yaml","duration-cases","locale-data"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}