{"record":{"id":"8e1de15427515bc3","repo":"OpenNHP/opennhp","slug":"failed-to-get-evidence-from-cc-or-agent-uuid","errorCode":null,"errorMessage":"failed to get evidence from CC or agent uuid","messagePattern":"failed to get evidence from CC or agent uuid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nhp/core/wasm/engine/host.go","lineNumber":102,"sourceCode":"\t}\n\n\tvar buf bytes.Buffer\n\tw := zlib.NewWriter(&buf)\n\t_, err = w.Write(evidenceBytes)\n\tw.Close()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to compress response body: %w\", err)\n\t}\n\n\treturn buf.Bytes(), nil\n}\n\nfunc GetEvidence() (string, error) {\n\tevidence, err := GetEvidenceWithCCUrl()\n\tif err != nil {\n\t\tevidence, err = GetEvidenceWithAgentUuid()\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to get evidence from CC or agent uuid\")\n\t\t}\n\t}\n\n\treturn base64.StdEncoding.EncodeToString(evidence), nil\n}\n\nfunc CalculateAgentUniqueId() (string, error) {\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcgroup, _ := os.ReadFile(\"/proc/self/cgroup\")\n\tcombined := hostname + string(cgroup)\n\tsum := sha256.Sum256([]byte(combined))\n\n\treturn hex.EncodeToString(sum[:]), nil\n}","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/nhp/core/wasm/engine/host.go#L84-L120","documentation":"GetEvidence tries to obtain evidence first via GetEvidenceWithCCUrl, then falls back to GetEvidenceWithAgentUuid. If both paths fail, it returns this generic error with no underlying detail, losing the root cause. It means the environment provides neither a working confidential-computing evidence source nor a usable agent uuid.","triggerScenarios":"GetEvidenceWithCCUrl errors (e.g. CC URL unset or unreachable) AND GetEvidenceWithAgentUuid also errors (e.g. agent unique id unavailable), when called from GetEvidence (nhp/core/wasm/engine/host.go:102).","commonSituations":"WASM module running outside a confidential-computing environment without the CC URL env/config; agent unique id not injected by the host; misconfigured deployment missing both evidence sources.","solutions":["Verify the confidential-computing (CC) URL configuration so GetEvidenceWithCCUrl succeeds","Ensure the agent unique id is properly provided to the WASM host so GetEvidenceWithAgentUuid works","Improve the error by wrapping both underlying errors: fmt.Errorf(\"failed to get evidence from CC or agent uuid: %w; %w\", ccErr, agentErr)"],"exampleFix":"// before\nif err != nil {\n\treturn \"\", fmt.Errorf(\"failed to get evidence from CC or agent uuid\")\n}\n// after\nif err != nil {\n\treturn \"\", fmt.Errorf(\"failed to get evidence from CC or agent uuid: %w\", err)\n}","handlingStrategy":"fallback","validationCode":"if ccUrl == \"\" && agentUniqueId == \"\" {\n\t// neither evidence source is configured; fail fast before calling GetEvidence\n}","typeGuard":null,"tryCatchPattern":"ev, err := GetEvidence()\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to get evidence\") {\n\t\t// check CC URL config and agent uuid availability, then retry\n\t}\n}","preventionTips":["Configure the CC URL or guarantee an agent unique id before invoking GetEvidence","Prefer wrapping both underlying errors for diagnosability","Add a startup check that at least one evidence source is available"],"tags":["go","wasm","evidence","attestation"],"backgroundTag":"missing-config-value","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"}