OpenNHP/opennhp · error

http request failed

Error message

http request failed: %w

What it means

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.

Solutions

  1. Check the attestation agent is running and listening: curl http://127.0.0.1:8006/aa/evidence?runtime_data=dhp inside the container
  2. If not on a CC platform, use the fallback path (GetEvidenceWithAgentUuid) instead of failing
  3. Start the AAA service or fix its configured listen address/port to match 127.0.0.1:8006

Example fix

// before
resp, err := client.Get(confidentialContainerEvidenceUrl)
// after
resp, err := client.Get(confidentialContainerEvidenceUrl)
if err != nil {
    log.Printf("AAA unreachable (%v), falling back to agent uuid evidence", err)
    return GetEvidenceWithAgentUuid()
}
Defensive patterns

Strategy: fallback

Validate before calling

conn, err := net.DialTimeout("tcp", "127.0.0.1:8006", time.Second)
if err != nil { return errors.New("attestation agent not reachable on :8006") }
conn.Close()

Try / catch

ev, err := engine.GetEvidence()
if err != nil {
    if strings.Contains(err.Error(), "http request failed") {
        ev, err = engine.GetEvidenceWithAgentUuid() // test fallback
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of OpenNHP/opennhp@6e04ca5ff0 (2026-09-07). Data as JSON: /api/errors/8be37282780b2b00. Report an issue: GitHub.

Appendix: source

Thrown at nhp/core/wasm/engine/host.go:42

var (
	confidentialContainerEvidenceUrl = "http://127.0.0.1:8006/aa/evidence?runtime_data=dhp"
)

func logString(_ context.Context, m api.Module, offset, byteCount uint32) {
	buf, ok := m.Memory().Read(offset, byteCount)
	if !ok {
		log.Panicf("Memory.Read(%d, %d) out of range", offset, byteCount)
	}
	fmt.Println(string(buf))
}

func GetEvidenceWithCCUrl() ([]byte, error) {
	client := &http.Client{Timeout: 3 * time.Second}

	resp, err := client.Get(confidentialContainerEvidenceUrl)
	if err != nil {
		return nil, fmt.Errorf("http request failed: %w", err)
	}

	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)
	}

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return nil, fmt.Errorf("failed to read response body: %w", err)
	}

	var buf bytes.Buffer
	w := zlib.NewWriter(&buf)
	_, err = w.Write(body)
	w.Close()
	if err != nil {

View on GitHub (pinned to 6e04ca5ff0)