{"record":{"id":"87b483d4917602a5","repo":"JanDeDobbeleer/oh-my-posh","slug":"unsupported-data-file-extension-s","errorCode":null,"errorMessage":"unsupported data file extension: %s","messagePattern":"unsupported data file extension: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/data.go","lineNumber":206,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"failed to parse data file: %w\", err)\n\t\t}\n\n\t\troot = normalized\n\tcase TOML, TML:\n\t\tvar generic map[string]any\n\n\t\tif err := toml.Unmarshal(raw, &generic); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse data file: %w\", err)\n\t\t}\n\n\t\tnormalized, err := normalize(generic)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse data file: %w\", err)\n\t\t}\n\n\t\troot = normalized\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported data file extension: %s\", ext)\n\t}\n\n\treturn root, nil\n}\n\n// dataFromRoot builds a Data from a generically-decoded document root,\n// shared by LoadData (any of its three formats) and ParseData (JSON only)\n// once each has the same map[string]json.RawMessage shape in hand.\nfunc dataFromRoot(root map[string]json.RawMessage) (*Data, error) {\n\tdata := &Data{}\n\n\tif versionRaw, OK := root[DataVersionKey]; OK {\n\t\tif err := json.Unmarshal(versionRaw, &data.Version); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse version in data file: %w\", err)\n\t\t}\n\t}\n\n\tif env, OK := root[DataEnvKey]; OK {","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/config/data.go#L188-L224","documentation":"Thrown when decodeDataRoot receives a file extension it does not recognize. Data files are only supported for JSON/JSONC (.json/.jsonc), YAML (.yaml/.yml) and TOML (.toml/.tml); anything else is rejected before any parsing is attempted.","triggerScenarios":"Calling LoadData with a path whose extension is not one of json, jsonc, yaml, yml, toml, tml - e.g. .ini, .conf, .properties, .txt, or a file with no extension at all.","commonSituations":"Pointing a data file setting at an environment export script (.sh, .ps1, .env); renaming a data file and losing the extension; Unix-style extensionless dotfiles; typos like .toml.bak that still end in .bak.","solutions":["Rename the file (or the configured path) to use a supported extension: .json, .jsonc, .yaml, .yml, .toml, or .tml","Convert the file's content into one of the supported formats if it currently uses another syntax","If the file has no extension, add the one matching its content format"],"exampleFix":"// before\nload(\"scripts/mydata.env\")\n// after\nload(\"scripts/mydata.json\")","handlingStrategy":"validation","validationCode":"supported := map[string]bool{\"json\":true,\"jsonc\":true,\"yaml\":true,\"yml\":true,\"toml\":true,\"tml\":true}\next := strings.TrimPrefix(filepath.Ext(path), \".\")\nif !supported[strings.ToLower(ext)] {\n\treturn fmt.Errorf(\"rename %s to use a supported extension\", path)\n}","typeGuard":null,"tryCatchPattern":"data, err := config.LoadData(path)\nif err != nil && strings.Contains(err.Error(), \"unsupported data file extension\") {\n\t// fall back to a known-good data file with a supported extension\n}","preventionTips":["Always give data files one of: .json/.jsonc/.yaml/.yml/.toml/.tml","Never point data-file settings at scripts or .env files","Watch out for double extensions like file.toml.bak","Keep extension and content format in sync"],"tags":["config","file-extension"],"backgroundTag":"unsupported-data-file-extension","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}