{"record":{"id":"b4f04639d7c28895","repo":"mastra-ai/mastra","slug":"github-capabilities-require-an-owner-repository-so","errorCode":null,"errorMessage":"GitHub capabilities require an owner/repository source.","messagePattern":"GitHub capabilities require an owner/repository source\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mastracode/factory/src/integrations/platform/github/integration.ts","lineNumber":1442,"sourceCode":"}\n\nfunction repositoryPath(sourceId: string, suffix: string): string {\n  const { owner, repo } = splitRepository(sourceId);\n  return `${API_PREFIX}/github/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/${suffix}`;\n}\n\nfunction pullRequestPath(\n  input: { connection: IntegrationConnection; sourceId: string },\n  pullRequestId: string,\n): string {\n  requireGithubConnection(input.connection);\n  return repositoryPath(input.sourceId, `pulls/${requirePositiveId(pullRequestId, 'pull request')}`);\n}\n\nfunction splitRepository(sourceId: string): { owner: string; repo: string } {\n  const slash = sourceId.indexOf('/');\n  if (slash <= 0 || slash === sourceId.length - 1) {\n    throw new Error('GitHub capabilities require an owner/repository source.');\n  }\n  return { owner: sourceId.slice(0, slash), repo: sourceId.slice(slash + 1) };\n}\n\nfunction parseIntakeIssue(sourceId: string, issue: GithubIssue): IntakeIssue {\n  return {\n    id: String(issue.number),\n    identifier: `#${issue.number}`,\n    title: issue.title,\n    url: issue.htmlUrl,\n    author: issue.user?.login ?? null,\n    state: issue.state,\n    stateType: issue.state,\n    priority: null,\n    assignee: issue.assignees[0] ?? null,\n    assignees: issue.assignees,\n    source: sourceId,\n    labels: issue.labels,","sourceCodeStart":1424,"sourceCodeEnd":1460,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/factory/src/integrations/platform/github/integration.ts#L1424-L1460","documentation":"Thrown by splitRepository when a sourceId does not contain an owner/repo pair separated by a slash (no slash, leading slash, or trailing slash). GitHub REST paths are built from owner and repo, so any capability call with a malformed source id fails here before a request is made.","triggerScenarios":"Calling any GitHub capability (issues, pulls, comments, etc.) with a sourceIds[0] value like 'my-repo', '/my-repo', or 'owner/' — anything where sourceId.indexOf('/') is <= 0 or at the last character.","commonSituations":"Passing a repository name instead of its full slug; the platform storing a local repo id instead of the GitHub full_name; trailing whitespace or trailing slash from copy-paste; intake sync wrote a slugless source.","solutions":["Pass the full GitHub slug ('owner/repo') as sourceId","Fix upstream source records so the stored slug matches GitHub's full_name","Trim the value and re-check for stray leading/trailing slashes before calling","Validate with a regex like /^[^/]+\\/[^/]+$/ before invoking"],"exampleFix":"// before\nawait github.listPullRequests({ installationId, sourceIds: ['my-repo'] });\n// after\nawait github.listPullRequests({ installationId, sourceIds: ['acme/my-repo'] });","handlingStrategy":"validation","validationCode":"function isValidOwnerRepo(sourceId: string): boolean {\n  const slash = sourceId.indexOf('/');\n  return slash > 0 && slash < sourceId.length - 1;\n}\nif (!isValidOwnerRepo(sourceId)) throw new Error(`sourceId '${sourceId}' must be 'owner/repo'`);","typeGuard":"function isGithubSlug(s: string): s is `${string}/${string}` {\n  const i = s.indexOf('/');\n  return i > 0 && i < s.length - 1;\n}","tryCatchPattern":"try {\n  await github.listPullRequests({ installationId, sourceIds: [sourceId] });\n} catch (err) {\n  if (err instanceof Error && err.message.includes('owner/repository source')) {\n    sourceId = await resolveGithubSlug(sourceId); // map local id -> owner/repo\n  } else throw err;\n}","preventionTips":["Store and pass GitHub full_name ('owner/repo') as sourceId everywhere","Normalize/trim slugs at ingestion time","Type sourceId as `${string}/${string}` in calling code to catch mistakes at compile time","Add a fixture/contract test asserting sourceIds are slugs"],"tags":["github","validation","source-id","slug"],"backgroundTag":"invalid-identifier-format","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}