{"record":{"id":"1ed5499acdda9b4f","repo":"toeverything/AFFiNE","slug":"artifact-unavailable","errorCode":"ARTIFACT_UNAVAILABLE","errorMessage":"The artifact is unavailable in the current scope.","messagePattern":"The artifact is unavailable in the current scope\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/backend/server/src/plugins/copilot/tools/artifact.ts","lineNumber":107,"sourceCode":"        });\n        return {\n          artifact_id,\n          ...result,\n          source: {\n            type: 'artifact',\n            workspace_id: options.workspace,\n            artifact_id,\n            name: result.name,\n            mime_type: result.mimeType,\n            revision: result.revision,\n          } satisfies ArtifactSource,\n        };\n      } catch (error) {\n        logger.warn('Artifact read denied or unavailable', error);\n        return toolError(\n          'Artifact Read Failed',\n          'The artifact is unavailable in the current scope.',\n          { code: 'ARTIFACT_UNAVAILABLE', retryable: false }\n        );\n      }\n    },\n  });\n","sourceCodeStart":89,"sourceCodeEnd":112,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/backend/server/src/plugins/copilot/tools/artifact.ts#L89-L112","documentation":"Catch branch of the artifact read tool: the retrieval/read call failed or was denied (permissions or missing/invalid artifact) within the current retrieval scope; the error is logged as a warning and converted to an ARTIFACT_UNAVAILABLE tool error so the model gets a structured failure.","triggerScenarios":"Returned when the artifact read throws in its try block, meaning access was denied or the artifact could not be fetched within the current scope.","commonSituations":"The copilot tried to read an attachment that was removed or is not in the allowed scope. Re-attach the file or include it in the chat scope.","solutions":["Request an artifact within the current scope.","Re-run the tool after the scope is updated."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}