{"record":{"id":"7bae50ae30599d51","repo":"multica-ai/multica","slug":"api-error-res-status-res-statustext","errorCode":null,"errorMessage":"API error: ${res.status} ${res.statusText}","messagePattern":"API error: (.+?) (.+?)","errorType":"http","errorClass":"ApiError","httpStatus":null,"severity":"error","filePath":"packages/core/api/client.ts","lineNumber":636,"sourceCode":"      ...this.authHeaders(),\n      ...(init?.extraHeaders ?? {}),\n      ...((init?.headers as Record<string, string>) ?? {}),\n    };\n\n    this.logger.info(`→ ${method} ${path}`, { rid });\n\n    const res = await fetch(`${this.baseUrl}${path}`, {\n      ...init,\n      headers,\n      credentials: \"include\",\n    });\n\n    if (!res.ok) {\n      if (res.status === 401) this.handleUnauthorized();\n      const { message, body } = await this.parseErrorBody(res, `API error: ${res.status} ${res.statusText}`);\n      const logLevel = res.status === 404 ? \"warn\" : \"error\";\n      this.logger[logLevel](`← ${res.status} ${path}`, { rid, duration: `${Date.now() - start}ms`, error: message });\n      throw new ApiError(message, res.status, res.statusText, body);\n    }\n\n    this.logger.info(`← ${res.status} ${path}`, { rid, duration: `${Date.now() - start}ms` });\n    return res;\n  }\n\n  private async fetch<T>(path: string, init?: RequestInit): Promise<T> {\n    const res = await this.fetchRaw(path, {\n      ...init,\n      extraHeaders: { \"Content-Type\": \"application/json\" },\n    });\n    // Handle 204 No Content\n    if (res.status === 204) {\n      return undefined as T;\n    }\n    return res.json() as Promise<T>;\n  }\n","sourceCodeStart":618,"sourceCodeEnd":654,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/packages/core/api/client.ts#L618-L654","documentation":"Wrap thrown by prepareHermesHome when prepareHermesTaskLocalState fails. That helper prepares the parts of the per-task overlay that must be task-local (state that must not leak across tasks, e.g. task-local session/database scaffolding) inside hermes-home; a failure there means the overlay's isolation contract cannot be established, so prepare fails closed.","triggerScenarios":"prepareHermesTaskLocalState cannot create/remove/permission the task-local state files under <hermes-home> — write or mkdir errors from permission mismatch, full disk, or stale files owned by another user.","commonSituations":"Same env-root recycled across daemon users; a partially-written overlay from a crashed previous run; read-only or full env-root volume.","solutions":["Read the wrapped error for the exact operation and path, then fix ownership/permissions of the hermes-home tree for the daemon user.","Delete the stale per-task env-root so prepare rebuilds the overlay from scratch.","Free space / remount read-write and retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := prepareHermesHome(...); err != nil {\n    if strings.Contains(err.Error(), \"prepare task-local state\") {\n        // wrapped fs error: repair hermes-home ownership or wipe the per-task env-root, retry prepare\n    }\n}","preventionTips":["Wipe per-task env-roots between daemon user changes.","Keep env-root writable and local.","Log the wrapped error verbatim — the sub-operation identifies the fix."],"tags":["go","hermes","execenv","filesystem","task-isolation"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}