{"record":{"id":"d60794e288b0673f","repo":"syncthing/syncthing","slug":"http-response-body","errorCode":null,"errorMessage":"{HTTP response body}","messagePattern":"\\{HTTP response body\\}","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/syncthing/cli/config.go","lineNumber":149,"sourceCode":"\t\treturn nil\n\t}\n\tif reflect.DeepEqual(h.cfg, h.original) {\n\t\treturn nil\n\t}\n\tbody, err := json.MarshalIndent(h.cfg, \"\", \"  \")\n\tif err != nil {\n\t\treturn err\n\t}\n\tresp, err := h.client.Post(\"system/config\", string(body))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\tbody, err := responseToBArray(resp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn errors.New(string(body))\n\t}\n\treturn nil\n}\n","sourceCodeStart":131,"sourceCodeEnd":153,"githubUrl":"https://github.com/syncthing/syncthing/blob/058bcd7334839663cf569501d3ac539034d45cb5/cmd/syncthing/cli/config.go#L131-L153","documentation":"Produced by the CLI config command when POSTing an updated configuration to system/config returns any non-200 status; the raw HTTP response body is surfaced as the error text. The daemon rejected the submitted config — most often a validation failure (invalid folder/device values) reported in the body.","triggerScenarios":"'syncthing cli config diff | syncthing cli config apply'-style flows, or any PutJSON to system/config where the submitted XML/JSON violates config validation on the running daemon (bad folder path, duplicate IDs, invalid interval values), or the API key/CSRF path was wrong (401/403).","commonSituations":"Applying a config edited for a different syncthing version with new/renamed fields; scripts pushing configs between nodes with mismatched versions; submitting a folder whose path does not exist on the target.","solutions":["Read the body text — it names the exact invalid field/value","Fix the offending config field and re-submit","Verify the target daemon version matches the config schema you are pushing (syncthing cli show system -> version)","Check the API key if the body hints at authorization (401)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := applyConfig(cfg)\nif err != nil {\n    // err.Error() is the daemon's validation body: surface it verbatim to the operator\n    return fmt.Errorf(\"daemon rejected config: %w\", err)\n}","preventionTips":["Validate config against the target version's schema before pushing (syncthing cli config dry checks)","Push configs only between same-version instances","Always capture and display the response body — it names the bad field"],"tags":["cli","api","configuration","validation"],"backgroundTag":null,"analyzedSha":"058bcd7334839663cf569501d3ac539034d45cb5","analyzedAt":"2026-08-15T07:53:43.174Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}