{"id":"4b6f3790a135aa22","repo":"docker/cli","slug":"top-level-object-must-be-a-mapping","errorCode":null,"errorMessage":"top-level object must be a mapping","messagePattern":"top-level object must be a mapping","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/loader/loader.go","lineNumber":69,"sourceCode":"\treturn volumespec.Parse(spec)\n}\n\n// WithDiscardEnvFiles sets the Options to discard the `env_file` section after resolving to\n// the `environment` section\nfunc WithDiscardEnvFiles(options *Options) {\n\toptions.discardEnvFiles = true\n}\n\n// ParseYAML reads the bytes from a file, parses the bytes into a mapping\n// structure, and returns it.\nfunc ParseYAML(source []byte) (map[string]any, error) {\n\tvar cfg any\n\tif err := yaml.Unmarshal(source, &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\t_, ok := cfg.(map[string]any)\n\tif !ok {\n\t\treturn nil, errors.New(\"top-level object must be a mapping\")\n\t}\n\tconverted, err := convertToStringKeysRecursive(cfg, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn converted.(map[string]any), nil\n}\n\n// Load reads a ConfigDetails and returns a fully loaded configuration\nfunc Load(configDetails types.ConfigDetails, opt ...func(*Options)) (*types.Config, error) {\n\tif len(configDetails.ConfigFiles) < 1 {\n\t\treturn nil, errors.New(\"no files specified\")\n\t}\n\n\toptions := &Options{\n\t\tInterpolate: &interp.Options{\n\t\t\tSubstitute:      template.Substitute,\n\t\t\tLookupValue:     configDetails.LookupEnv,","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/compose/loader/loader.go#L51-L87","documentation":"Error \"top-level object must be a mapping\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/compose/loader/loader.go:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}