{"record":{"id":"7976502b0d34e883","repo":"different-ai/openwork","slug":"failed-to-copy-attachment-metadata-filename-i","errorCode":null,"errorMessage":"Failed to copy attachment \"${metadata.filename}\" into this worker workspace: upload was rejected","messagePattern":"Failed to copy attachment \"(.+?)\" into this worker workspace: upload was rejected","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/domains/session/sync/attachment-file-part.ts","lineNumber":381,"sourceCode":"      ? attachment.file\n      : await compressImageFile(attachment.file);\n    const metadata = resolveAttachmentFileMetadata(file);\n    const id = input.createId ? input.createId() : randomAttachmentId();\n    const inboxPath = buildChatAttachmentInboxPath({\n      sessionId: input.sessionId,\n      filename: metadata.filename,\n      id,\n    });\n\n    let result: InboxUploadResult;\n    try {\n      result = await input.endpoint.client.uploadInbox(workspaceId, file, { path: inboxPath });\n    } catch (error) {\n      throw new Error(uploadErrorMessage(metadata.filename, error));\n    }\n\n    if (result.ok === false) {\n      throw new Error(`Failed to copy attachment \"${metadata.filename}\" into this worker workspace: upload was rejected`);\n    }\n    if (!result.path.trim()) {\n      throw new Error(`Failed to copy attachment \"${metadata.filename}\" into this worker workspace: upload did not return a path`);\n    }\n    if (result.bytes !== file.size) {\n      throw new Error(`Failed to copy attachment \"${metadata.filename}\" into this worker workspace: expected ${file.size} bytes, wrote ${result.bytes}`);\n    }\n\n    const workspacePath = workspaceInboxPath(result.path);\n    const absolutePath = joinWorkspaceRelativePath(workspaceRoot, workspacePath);\n    uploaded.push({\n      filename: metadata.filename,\n      mime: metadata.mime,\n      bytes: result.bytes,\n      workspacePath,\n      url: toFileUrl(absolutePath),\n      file,\n    });","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/domains/session/sync/attachment-file-part.ts#L363-L399","documentation":"After uploadInbox returns, the code checks result.ok. A false value means the server accepted the request but rejected the upload (e.g. quota, invalid path, storage failure), so it throws this per-file rejection message. Unlike the wrapped-throw case, the upload call itself did not throw.","triggerScenarios":"uploadInbox resolves with { ok: false } — server-side validation rejected the file, inbox storage refused the write, or the endpoint returned a structured failure for that path.","commonSituations":"Server inbox full or read-only; upload path violates server-side policy (reserved names/paths); version mismatch where client/server disagree on the upload contract.","solutions":["Check the server response/logs for the rejection reason and fix server-side constraints (quota, path policy).","Retry the upload after freeing inbox space or correcting the path.","Update client and server so both agree on the uploadInbox result contract."],"exampleFix":"// after uploadInbox resolves: if (result.ok === false) { notify(`Upload rejected for ${file.name}: check server inbox policy/quota`) }","handlingStrategy":"try-catch","validationCode":"const inboxStatus = await client.inboxStatus?.(workspaceId); if (inboxStatus && !inboxStatus.writable) { showToast('Workspace inbox is not writable; free space or fix policy'); return; }","typeGuard":null,"tryCatchPattern":"try { await composerAttachmentsToWorkspaceFileParts({ attachments, endpoint, sessionId, workspaceRoot }); } catch (e) { if (String(e.message).includes('upload was rejected')) { showToast('Server rejected the upload — check inbox quota/policy'); } else { throw e; } }","preventionTips":["Monitor server inbox quota and permissions before large uploads.","Keep client/server uploadInbox contract versions in sync.","Log the server rejection reason to diagnose policy violations."],"tags":["upload","attachments","server-rejection"],"backgroundTag":"attachment-upload-rejected","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}