{"record":{"id":"b2de4f700a80ca83","repo":"docker/cli","slug":"parsing-s-v","errorCode":null,"errorMessage":"parsing %s: %v","messagePattern":"parsing (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/context/store/metadatastore.go","lineNumber":85,"sourceCode":"\t}\n\treturn m, nil\n}\n\nfunc (s *metadataStore) getByID(id contextdir) (Metadata, error) {\n\tfileName := filepath.Join(s.contextDir(id), metaFile)\n\tbytes, err := os.ReadFile(fileName)\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\treturn Metadata{}, notFound(fmt.Errorf(\"context not found: %w\", err))\n\t\t}\n\t\treturn Metadata{}, err\n\t}\n\tvar untyped untypedContextMetadata\n\tr := Metadata{\n\t\tEndpoints: make(map[string]any),\n\t}\n\tif err := json.Unmarshal(bytes, &untyped); err != nil {\n\t\treturn Metadata{}, fmt.Errorf(\"parsing %s: %v\", fileName, err)\n\t}\n\tr.Name = untyped.Name\n\tif r.Metadata, err = parseTypedOrMap(untyped.Metadata, s.config.contextType); err != nil {\n\t\treturn Metadata{}, fmt.Errorf(\"parsing %s: %v\", fileName, err)\n\t}\n\tfor k, v := range untyped.Endpoints {\n\t\tif r.Endpoints[k], err = parseTypedOrMap(v, s.config.endpointTypes[k]); err != nil {\n\t\t\treturn Metadata{}, fmt.Errorf(\"parsing %s: %v\", fileName, err)\n\t\t}\n\t}\n\treturn r, err\n}\n\nfunc (s *metadataStore) remove(name string) error {\n\tif err := os.RemoveAll(s.contextDir(contextdirOf(name))); err != nil {\n\t\treturn fmt.Errorf(\"failed to remove metadata: %w\", err)\n\t}\n\treturn nil","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/context/store/metadatastore.go#L67-L103","documentation":"Returned by getByID when the context's meta.json fails to unmarshal into the base untypedContextMetadata struct (Name/Metadata/Endpoints). The file exists but its top-level JSON is malformed.","triggerScenarios":"meta.json exists but contains invalid JSON: truncated, hand-edited with a syntax error, wrong encoding (e.g. UTF-16 BOM), or a partial/garbled write.","commonSituations":"Disk full during a write; manual edits to meta.json; copy/sync corruption; a third-party tool that wrote bad JSON; process killed mid-write.","solutions":["Recreate the context (`docker context rm <name>` then `docker context create`); if rm also fails on parse, remove the dir under ~/.docker/contexts/meta/<hash> manually.","Validate the JSON: `jq . ~/.docker/contexts/meta/<hash>/meta.json` to see the exact parse error.","Restore meta.json from a prior export/backup."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-validate meta.json before relying on the store to read it.\nfunc validMetaJSON(p string) bool {\n    b, err := os.ReadFile(p)\n    if err != nil {\n        return false\n    }\n    return json.Valid(b)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-edit meta.json; use docker context commands.","Back up / export contexts so a corrupted meta.json is recoverable.","Validate suspect JSON with `jq .` to localize the parse error."],"tags":["context","json","parsing","corruption"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}