{"record":{"id":"d478797317d32cef","repo":"multica-ai/multica","slug":"attachment-too-large-for-inline-preview","errorCode":null,"errorMessage":"attachment too large for inline preview","messagePattern":"attachment too large for inline preview","errorType":"exception","errorClass":"PreviewTooLargeError","httpStatus":413,"severity":"error","filePath":"packages/core/api/client.ts","lineNumber":2982,"sourceCode":"  // bypasses Content-Disposition: attachment for the `text/*` family, both\n  // of which would otherwise prevent the renderer from getting the body.\n  // The server always replies with `text/plain; charset=utf-8` for safety;\n  // the original MIME ships back in the `X-Original-Content-Type` header so\n  // the preview dispatcher can choose between markdown / html / plain code.\n  //\n  // Routes through `fetchRaw` so it inherits the standard auth headers,\n  // 401 → handleUnauthorized recovery, request-id logging, and ApiError\n  // shape. 413 / 415 are translated to typed `Preview*Error` instances so\n  // the modal can render specific fallbacks instead of generic failure.\n  async getAttachmentTextContent(\n    id: string,\n  ): Promise<{ text: string; originalContentType: string }> {\n    let res: Response;\n    try {\n      res = await this.fetchRaw(`/api/attachments/${id}/content`);\n    } catch (err) {\n      if (err instanceof ApiError) {\n        if (err.status === 413) throw new PreviewTooLargeError();\n        if (err.status === 415) throw new PreviewUnsupportedError();\n      }\n      throw err;\n    }\n    return {\n      text: await res.text(),\n      originalContentType: res.headers.get(\"X-Original-Content-Type\") ?? \"\",\n    };\n  }\n\n  // Fetches the raw bytes of an attachment through the unified download\n  // endpoint.\n  //\n  // This is the last-resort inline-media path for deployments where the\n  // server has no natively-loadable URL to offer. `GET /api/attachments/{id}`\n  // only upgrades `download_url` to a signed storage URL under CloudFront\n  // signing or presign mode; in **proxy** mode (self-hosted MinIO or any\n  // storage endpoint on an internal host, which the default `auto` mode","sourceCodeStart":2964,"sourceCodeEnd":3000,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/packages/core/api/client.ts#L2964-L3000","documentation":"Wrap thrown by prepareHermesHome when mountHermesMemories fails. With a memory store configured, the overlay's memories/ dir is linked at the agent's persistent store so memories survive the task; failure to establish the link is fatal because the alternative would silently lose the agent's memory contract.","triggerScenarios":"prepareHermesHome is called with a non-empty memoryStore and mountHermesMemories(hermesHome, memoryStore, logger) errors — the store path is unusable (wrong type, unreadable, cross-filesystem link failure) or a conflicting memories/ entry already exists in the overlay.","commonSituations":"Memory store directory deleted or moved after the agent was created; store on NFS with permission issues; stale memories/ symlink left in a recycled env-root; store owned by a different daemon user.","solutions":["Check that the memory store path exists, is a directory, and is writable by the daemon user.","Clear the stale memories/ entry inside the per-task hermes-home and retry prepare.","Recreate or re-provision the agent's memory store if it was deleted.","Align filesystems: keep the store on the same filesystem as env-root if the mount uses links."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if memoryStore != \"\" {\n    fi, err := os.Stat(memoryStore)\n    if err != nil || !fi.IsDir() {\n        return fmt.Errorf(\"memory store missing or not a dir: %s\", memoryStore)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := prepareHermesHome(...); err != nil {\n    if strings.Contains(err.Error(), \"mount agent memories\") {\n        // repair/recreate the memory store dir, or disable memory persistence for this agent deliberately\n    }\n}","preventionTips":["Create the memory store dir at agent creation time.","Include memory stores in backup/restore runbooks.","Alert when store paths disappear from disk."],"tags":["go","hermes","execenv","memory","filesystem","persistence"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}