{"record":{"id":"1c1ef8eb7c8dce74","repo":"hashicorp/terraform","slug":"unknown-nesting-mode-d","errorCode":null,"errorMessage":"unknown nesting mode: %d","messagePattern":"unknown nesting mode: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/moduletest/mocking/fill.go","lineNumber":67,"sourceCode":"\t\t\t\tif in.Type().HasAttribute(name) {\n\t\t\t\t\tchild, err := fillAttribute(in.GetAttr(name), attribute.NestedType.Attributes[name], path.GetAttr(name))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn cty.NilVal, err\n\t\t\t\t\t}\n\t\t\t\t\tchildren[name] = child\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tchildren[name] = GenerateValueForAttribute(attribute.NestedType.Attributes[name])\n\t\t\t}\n\t\t\treturn cty.ObjectVal(children), nil\n\t\tcase configschema.NestingSet:\n\t\t\treturn cty.SetValEmpty(attribute.ImpliedType().ElementType()), nil\n\t\tcase configschema.NestingList:\n\t\t\treturn cty.ListValEmpty(attribute.ImpliedType().ElementType()), nil\n\t\tcase configschema.NestingMap:\n\t\t\treturn cty.MapValEmpty(attribute.ImpliedType().ElementType()), nil\n\t\tdefault:\n\t\t\tpanic(fmt.Errorf(\"unknown nesting mode: %d\", attribute.NestedType.Nesting))\n\t\t}\n\t}\n\n\treturn fillType(in, attribute.Type, path)\n}\n\n// FillType makes the input value match the target type by adding attributes\n// directly to it or to any nested objects. Essentially, this is a \"safe\"\n// conversion between two objects.\n//\n// This function can error if one of the embedded types within value doesn't\n// match the type expected by target.\n//\n// If the supplied value isn't an object (or a map that can be treated as an\n// object) then a normal conversion is attempted from value into target.\n//\n// Superfluous attributes within the supplied value (ie. attributes not\n// mentioned by the target type) are dropped without error.","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/moduletest/mocking/fill.go#L49-L85","documentation":"Panics in mocking.fillAttribute (fill.go:67). When filling placeholder values for a nested-type attribute, the switch handles the known configschema nesting modes (Single, Group, Set, List, Map); an unrecognized nesting integer panics, indicating a schema with an invalid/out-of-range Nesting value.","triggerScenarios":"A mocked resource/attribute whose NestedType.Nesting is set to an undefined value (not one of the configschema.Nesting constants), exercised via the mock_provider / test mocking feature.","commonSituations":"Bugs in schema construction for mocks, or a configschema.Nesting value from a newer/incompatible version not handled by this fill implementation.","solutions":["Ensure NestedType.Nesting uses defined configschema constants.","Regenerate the mock schema from the real provider schema.","Align the mock schema with the nesting modes this build supports."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func nestingModeKnown(n configschema.NestingMode) error {\n    switch n {\n    case configschema.NestingSingle, configschema.NestingGroup,\n        configschema.NestingSet, configschema.NestingList, configschema.NestingMap:\n        return nil\n    }\n    return fmt.Errorf(\"unknown nesting mode: %d\", n)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only defined configschema nesting constants in mock schemas.","Regenerate mocks from the real provider schema.","Align mock schema nesting with supported modes."],"tags":["terraform","testing","mocking","schema","panic"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}