{"record":{"id":"8be37282780b2b00","repo":"OpenNHP/opennhp","slug":"http-request-failed-w","errorCode":null,"errorMessage":"http request failed: %w","messagePattern":"http request failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nhp/core/wasm/engine/host.go","lineNumber":42,"sourceCode":"\nvar (\n\tconfidentialContainerEvidenceUrl = \"http://127.0.0.1:8006/aa/evidence?runtime_data=dhp\"\n)\n\nfunc logString(_ context.Context, m api.Module, offset, byteCount uint32) {\n\tbuf, ok := m.Memory().Read(offset, byteCount)\n\tif !ok {\n\t\tlog.Panicf(\"Memory.Read(%d, %d) out of range\", offset, byteCount)\n\t}\n\tfmt.Println(string(buf))\n}\n\nfunc GetEvidenceWithCCUrl() ([]byte, error) {\n\tclient := &http.Client{Timeout: 3 * time.Second}\n\n\tresp, err := client.Get(confidentialContainerEvidenceUrl)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"http request failed: %w\", err)\n\t}\n\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"unexpected status code: %d\", resp.StatusCode)\n\t}\n\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read response body: %w\", err)\n\t}\n\n\tvar buf bytes.Buffer\n\tw := zlib.NewWriter(&buf)\n\t_, err = w.Write(body)\n\tw.Close()\n\tif err != nil {","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/nhp/core/wasm/engine/host.go#L24-L60","documentation":"GetEvidenceWithCCUrl performs an HTTP GET against the local confidential-computing attestation agent (http://127.0.0.1:8006/aa/evidence?runtime_data=dhp) with a 3-second timeout; this error wraps any transport-level failure of that request.","triggerScenarios":"Calling GetEvidence (which falls through to GetEvidenceWithCCUrl) when the CoCo attestation-agent process is not running, the port is wrong, the listener refuses the connection, or the request exceeds the 3s timeout.","commonSituations":"Deploying a DHP workload outside a confidential container where no AAA (attestation agent) listens on 8006; AAA crashed or still starting when the first knock arrived; firewall inside the pod blocking localhost:8006; AAA under load exceeding the 3s timeout.","solutions":["Check the attestation agent is running and listening: curl http://127.0.0.1:8006/aa/evidence?runtime_data=dhp inside the container","If not on a CC platform, use the fallback path (GetEvidenceWithAgentUuid) instead of failing","Start the AAA service or fix its configured listen address/port to match 127.0.0.1:8006"],"exampleFix":"// before\nresp, err := client.Get(confidentialContainerEvidenceUrl)\n// after\nresp, err := client.Get(confidentialContainerEvidenceUrl)\nif err != nil {\n    log.Printf(\"AAA unreachable (%v), falling back to agent uuid evidence\", err)\n    return GetEvidenceWithAgentUuid()\n}","handlingStrategy":"fallback","validationCode":"conn, err := net.DialTimeout(\"tcp\", \"127.0.0.1:8006\", time.Second)\nif err != nil { return errors.New(\"attestation agent not reachable on :8006\") }\nconn.Close()","typeGuard":null,"tryCatchPattern":"ev, err := engine.GetEvidence()\nif err != nil {\n    if strings.Contains(err.Error(), \"http request failed\") {\n        ev, err = engine.GetEvidenceWithAgentUuid() // test fallback\n    }\n}","preventionTips":["Deploy the CoCo attestation agent in every CC workload image","Health-check 127.0.0.1:8006 before protocol flows","Raise the 3s timeout for loaded environments"],"tags":["network","http","attestation","local-service"],"backgroundTag":"http-request-failed","analyzedSha":"6e04ca5ff03222a699c24205cd4bf8fee9af7ffe","analyzedAt":"2026-09-07T15:44:59.941Z","contentChangedAt":"2026-09-07T15:44:59.941Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}