paperclipai/paperclip · error · GitHubAttachmentUnavailableError
github_attachment_source_mismatch
github_attachment_source_mismatch
Error message
github_attachment_source_mismatch
What it means
After checking App authority, resolveGitHubAttachmentComment validates the request shape with isGitHubAttachmentCommentRequest. A request that is not a recognized GitHub attachment comment request (wrong origin, malformed fields, or a URL/attachment from another provider) causes GitHubAttachmentUnavailableError('github_attachment_source_mismatch'), signaling the request does not correspond to a canonical GitHub source this runtime can resolve.
Source
Thrown at server/src/services/chat-sdk-runtime.ts:2839
signal: AbortSignal,
): Promise<Buffer> {
const fetcher = this.teamsInlineImageFetchers.get(attachment);
if (!fetcher || signal.aborted)
throw new Error("Teams inline image download unavailable");
return await fetcher(signal);
}
/** Called only after current inbound admission; installation App authority only. */
async resolveGitHubAttachmentComment(
request: GitHubAttachmentCommentRequest,
signal: AbortSignal,
): Promise<unknown> {
if (!this.githubAttachmentAppAuthority)
throw new GitHubAttachmentUnavailableError(
"github_attachment_canonical_authority_unavailable",
);
if (!isGitHubAttachmentCommentRequest(request))
throw new GitHubAttachmentUnavailableError(
"github_attachment_source_mismatch",
);
try {
signal.throwIfAborted();
const result = await (this.adapter as GitHubAdapter).octokit.request(
`GET ${request.url}`,
{
headers: {
accept: request.accept,
"x-github-api-version": "2022-11-28",
},
request: {
signal,
redirect: "manual",
fetch: githubAttachmentCommentFetch(request, signal),
},
},
);View on GitHub (pinned to 01ad858492)
Solutions
- Build the GitHubAttachmentCommentRequest from the admitted inbound attachment data, not manually
- Verify the attachment origin is GitHub and the URL matches the expected GitHub API shape
- Regenerate/re-admit the request if persisted data predates a validator/schema change
- Confirm you are calling the GitHub resolver with GitHub-sourced attachments only
Example fix
// before
await runtime.resolveGitHubAttachmentComment({ url: someUrl } as any, signal);
// after
if (isGitHubAttachmentCommentRequest(req)) {
await runtime.resolveGitHubAttachmentComment(req, signal);
} Defensive patterns
Strategy: validation
Validate before calling
if (!isGitHubAttachmentCommentRequest(request)) throw new Error('not a GitHub attachment comment request'); Type guard
const isGitHubAttachmentCommentRequest = (r: unknown): r is GitHubAttachmentCommentRequest => typeof r === 'object' && r !== null && typeof (r as any).url === 'string' && (r as any).url.startsWith('https://api.github.com/'); Try / catch
try { return await runtime.resolveGitHubAttachmentComment(request, signal); } catch (e) { if ((e as Error).message === 'github_attachment_source_mismatch') { /* rebuild request from admitted inbound data */ } else throw e; } Prevention
- Construct requests only from admitted inbound attachment data
- Re-validate persisted requests after shared-type/validator changes
- Never reuse attachment request objects across chat providers
When it happens
Trigger: Passing a GitHubAttachmentCommentRequest whose payload fails isGitHubAttachmentCommentRequest validation — e.g. an attachment captured from Slack/Teams reused here, a hand-built request missing required GitHub fields, or a URL outside the expected GitHub domain/repo.
Common situations: Cross-provider attachment handling bugs; schema drift after shared-type updates so older persisted requests no longer validate; constructing the request manually instead of from admitted inbound data.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- github_attachment_canonical_response_unavailable
- github_attachment_canonical_html_unavailable
- github_attachment_canonical_file_unsupported
- github_attachment_canonical_image_count_invalid
- github_attachment_canonical_target_denied
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10).
Data as JSON: /api/errors/da5640f0bc6dc5bb.
Report an issue: GitHub.