{"record":{"id":"d1f866731e3f58fe","repo":"multica-ai/multica","slug":"upload-failed-res-status","errorCode":null,"errorMessage":"Upload failed: ${res.status}","messagePattern":"Upload failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/api/client.ts","lineNumber":2653,"sourceCode":"    if (opts?.chatSessionId) formData.append(\"chat_session_id\", opts.chatSessionId);\n\n    const rid = createRequestId();\n    const start = Date.now();\n    this.logger.info(\"→ POST /api/upload-file\", { rid });\n\n    const res = await fetch(`${this.baseUrl}/api/upload-file`, {\n      method: \"POST\",\n      headers: this.authHeaders(),\n      body: formData,\n      credentials: \"include\",\n      signal,\n    });\n\n    if (!res.ok) {\n      if (res.status === 401) this.handleUnauthorized();\n      const message = await this.parseErrorMessage(res, `Upload failed: ${res.status}`);\n      this.logger.error(`← ${res.status} /api/upload-file`, { rid, duration: `${Date.now() - start}ms`, error: message });\n      throw new Error(message);\n    }\n\n    this.logger.info(`← ${res.status} /api/upload-file`, { rid, duration: `${Date.now() - start}ms` });\n    const raw = (await res.json()) as unknown;\n    return parseWithFallback(raw, AttachmentResponseSchema, EMPTY_ATTACHMENT, {\n      endpoint: \"POST /api/upload-file\",\n    });\n  }\n\n  // Chat Sessions\n  async listChatSessions(\n    params?: { status?: string },\n    workspaceSlug?: string,\n  ): Promise<ChatSession[]> {\n    const query = params?.status ? `?status=${params.status}` : \"\";\n    return this.fetch(`/api/chat/sessions${query}`, {\n      headers: workspaceHeader(workspaceSlug),\n    });","sourceCodeStart":2635,"sourceCodeEnd":2671,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/packages/core/api/client.ts#L2635-L2671","documentation":"Wrap thrown by prepareHermesHome when mountHermesSessionDB fails. When a persistent session store is configured, the overlay's state.db is linked to it so the conversation transcript survives the task; the mount result also reports whether history is actually present so the caller never promises a resume that is not there. Contrary to some comments, this link failing IS fatal here — though a store that is merely absent leaves the database task-local by design.","triggerScenarios":"prepareHermesHome is called with a non-empty sessionStore and mountHermesSessionDB(hermesHome, sessionStore, logger) errors — e.g. the store path exists but is not a regular file/dir as expected, linking fails across filesystems or due to permissions, or a conflicting state.db already occupies the target.","commonSituations":"Session store on a different filesystem than env-root where the link strategy does not apply; store file corrupted or truncated to a non-database; permission drift on the conversation store directory; leftover state.db symlink from an aborted run.","solutions":["Verify the session store path exists with the expected type and is writable by the daemon user.","Remove the conflicting state.db entry inside the per-task hermes-home so a fresh link can be made.","If the store lives on another filesystem or an unsupported mount, relocate it to the same filesystem as env-root or drop the store config to keep sessions task-local.","Restore/recreate a corrupted conversation store from backup or reset it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if sessionStore != \"\" {\n    fi, err := os.Stat(sessionStore)\n    if err != nil {\n        return fmt.Errorf(\"session store unreachable: %w\", err)\n    }\n    if err := checkWritable(filepath.Dir(sessionStore)); err != nil {\n        return fmt.Errorf(\"session store dir not writable: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := prepareHermesHome(...); err != nil {\n    if strings.Contains(err.Error(), \"mount conversation sessions\") {\n        // decide: fix the store, or drop sessionStore config to keep sessions task-local (explicit fallback choice)\n    }\n}","preventionTips":["Health-check conversation store paths before dispatching tasks that promise resume.","Keep stores on the same filesystem as env-root when links are used.","Never delete store files while tasks referencing them may run."],"tags":["go","hermes","execenv","sessions","filesystem","persistence"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}