{"record":{"id":"f57e2c20c6687ac2","repo":"Netflix/chaosmonkey","slug":"post-to-s-failed-body-s","errorCode":null,"errorMessage":"POST to %s failed, (body '%s')","messagePattern":"POST to (.+?) failed, \\(body '(.+?)'\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spinnaker/terminator.go","lineNumber":84,"sourceCode":"// Kill implements term.Terminator.Kill\nfunc (t fakeTerminator) Execute(trm chaosmonkey.Termination) error {\n\treturn nil\n}\n\n// Execute implements term.Terminator.Execute\nfunc (s Spinnaker) Execute(trm chaosmonkey.Termination) (err error) {\n\tins := trm.Instance\n\turl := s.tasksURL(ins.AppName())\n\n\totherID, err := s.OtherID(ins)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"retrieve other id failed\")\n\t}\n\n\tpayload := killJSONPayload(ins, otherID, s.user)\n\tresp, err := s.client.Post(url, \"application/json\", bytes.NewReader(payload))\n\tif err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"POST to %s failed, (body '%s')\", url, string(payload)))\n\t}\n\n\tdefer func() {\n\t\tif cerr := resp.Body.Close(); cerr != nil && err == nil {\n\t\t\terr = errors.Wrap(cerr, fmt.Sprintf(\"failed to close response body of %s\", url))\n\t\t}\n\t}()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tlog.Printf(\"Unexpected response: %d\", resp.StatusCode)\n\t\tcontents, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to read response body\")\n\t\t}\n\t\treturn fmt.Errorf(\"unexpected response code: %d, body: %s\", resp.StatusCode, string(contents))\n\t}\n\n\treturn nil","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/spinnaker/terminator.go#L66-L102","documentation":"Execute throws this when the http.Client.Post to the Spinnaker task endpoint fails at the transport level — no HTTP response was received at all. The message embeds the URL and the exact kill JSON payload that was attempted, so you can see precisely what request failed. This is the step that actually issues the instance kill; if you see it, no termination happened.","triggerScenarios":"POST <spinnaker-api>/tasks with the killJSONPayload body fails: DNS failure, connection refused/reset, TLS error, or client timeout while talking to Spinnaker Gate.","commonSituations":"Spinnaker Gate is down or unreachable from where chaosmonkey runs; incorrect SPINNAKER endpoint URL in config; firewall/security-group rules blocking egress; TLS certificate mismatch; Gate overloaded and dropping connections during a large experiment.","solutions":["Check Spinnaker Gate is reachable: curl the URL in the error message from the host running chaosmonkey.","Verify the spinnaker endpoint configuration (scheme, host, port, path) in chaosmonkey config/env.","Check the embedded payload in the error to confirm the kill request body is well-formed and targets the right instance.","Inspect Gate logs and network paths (LB, security groups, DNS) for connection failures.","Add retry with backoff for transient transport errors, and ensure the http.Client timeout is appropriate for task submission."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"u, err := url.Parse(spinnakerEndpoint)\nif err != nil || u.Scheme == \"\" || u.Host == \"\" {\n\treturn fmt.Errorf(\"invalid spinnaker endpoint: %q\", spinnakerEndpoint)\n}\n// connectivity pre-check\nresp, err := client.Get(spinnakerEndpoint + \"/health\")\nif err != nil {\n\treturn fmt.Errorf(\"spinnaker gate unreachable: %v\", err)\n}\nresp.Body.Close()","typeGuard":null,"tryCatchPattern":"resp, err := s.client.Post(url, \"application/json\", bytes.NewReader(payload))\nif err != nil {\n\tif isRetryableNetErr(errors.Cause(err)) {\n\t\t// retry with backoff\n\t}\n\treturn errors.Wrap(err, fmt.Sprintf(\"POST to %s failed, (body '%s')\", url, string(payload)))\n}","preventionTips":["Pre-flight check Gate reachability before starting experiment runs","Validate the spinnaker endpoint URL in config at startup","Set appropriate http.Client timeouts and retry transient POSTs idempotently","Check egress firewall/security-group rules from the chaosmonkey host"],"tags":["go","http","network","spinnaker","post"],"backgroundTag":"http-request-failed","analyzedSha":"eaa28fb761c0ebe8644d1333e5d164e9cc3071e9","analyzedAt":"2026-09-03T17:04:39.020Z","contentChangedAt":"2026-09-03T17:04:39.020Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}