{"record":{"id":"e238dfbbbf9fbb57","repo":"vitessio/vitess","slug":"unsupported-config-format","errorCode":null,"errorMessage":"unsupported config format","messagePattern":"unsupported config format","errorType":"http","errorClass":null,"httpStatus":400,"severity":"info","filePath":"go/viperutil/debug/handler.go","lineNumber":80,"sourceCode":"\t\tv.SetConfigType(format)\n\t\ttmp, err := os.CreateTemp(\"\", \"viper_debug\")\n\t\tif err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"failed to render config to tempfile: %v\", err), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tdefer os.Remove(tmp.Name())\n\n\t\tif err := v.WriteConfigAs(tmp.Name()); err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"failed to render config to tempfile: %v\", err), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tif _, err := io.Copy(w, tmp); err != nil {\n\t\t\thttp.Error(w, fmt.Sprintf(\"failed to write rendered config: %v\", err), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\tdefault:\n\t\thttp.Error(w, \"unsupported config format\", http.StatusBadRequest)\n\t}\n}\n","sourceCodeStart":62,"sourceCodeEnd":83,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/viperutil/debug/handler.go#L62-L83","documentation":"The debug config handler switches on the requested format; the default branch rejects any format value it does not recognize with 400 Bad Request 'unsupported config format'. The handler only supports the formats it explicitly enumerates.","triggerScenarios":"Hitting the debug config endpoint with a format query parameter whose value is not in the handler's switch (e.g. 'ini', 'xml', 'env', or a misspelling like 'yml' for 'yaml').","commonSituations":"Guessing the format parameter name/value; copy-pasting a format from another tool; bookmarking an old URL after supported formats changed.","solutions":["Use one of the formats the switch accepts (json, yaml, toml, hcl as supported by the handler).","Spell the format exactly as supported — 'yaml', not 'yml'.","Omit or correct the format query parameter and re-read the endpoint's documented usage."],"exampleFix":"// before\ncurl 'http://localhost:15000/debug/config?format=ini'\n// after\ncurl 'http://localhost:15000/debug/config?format=json'","handlingStrategy":"validation","validationCode":"const allowed = \"json|yaml|toml|hcl\"\nif !strings.Contains(\"|\"+allowed+\"|\", \"|\"+format+\"|\") {\n\treturn fmt.Errorf(\"use one of: %s\", allowed)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enumerate accepted formats once and share the constant between callers and docs.","Validate the format query parameter in scripts before building the URL."],"tags":["http","config","bad-request","validation"],"backgroundTag":"unsupported-config-format","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}