{"record":{"id":"5293b3f27ea8a050","repo":"mastra-ai/mastra","slug":"githubintegration-missing-required-config-field-s","errorCode":null,"errorMessage":"GithubIntegration: missing required config field(s): ${missing.join(', ')}. Provide the full GitHub App credentials (appId, privateKey, clientId, clientSecret, slug) or omit the integration to disable GitHub-backed repositories.","messagePattern":"GithubIntegration: missing required config field\\(s\\): (.+?)\\. Provide the full GitHub App credentials \\(appId, privateKey, clientId, clientSecret, slug\\) or omit the integration to disable GitHub-backed repositories\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mastracode/factory/src/integrations/github/integration.ts","lineNumber":350,"sourceCode":"   * The OAuth/install flow round-trips a signed `state` through GitHub, so a\n   * multi-replica deploy needs a deployment-stable state secret.\n   */\n  readonly requiresStableStateSigner = true;\n\n  readonly #appId: string;\n  readonly #privateKey: string;\n  readonly #clientId: string;\n  readonly #clientSecret: string;\n  readonly #slug: string;\n  readonly #webhookSecret: string | undefined;\n  readonly #authorizedBots: readonly string[];\n  #storage: IntegrationContext['storage'] | undefined;\n  #sourceControlStorage: IntegrationContext['storage']['sourceControl'] | undefined;\n\n  constructor(config: GithubIntegrationConfig) {\n    const missing = REQUIRED_FIELDS.filter(field => !config[field]);\n    if (missing.length > 0) {\n      throw new Error(\n        `GithubIntegration: missing required config field(s): ${missing.join(', ')}. ` +\n          `Provide the full GitHub App credentials (appId, privateKey, clientId, clientSecret, slug) ` +\n          `or omit the integration to disable GitHub-backed repositories.`,\n      );\n    }\n    this.#appId = config.appId;\n    this.#privateKey = normalizePrivateKey(config.privateKey);\n    this.#clientId = config.clientId;\n    this.#clientSecret = config.clientSecret;\n    this.#slug = config.slug;\n    this.#webhookSecret = config.webhookSecret || undefined;\n    this.#authorizedBots = (config.authorizedBots ?? []).map(bot => bot.trim()).filter(Boolean);\n  }\n\n  /** App slug — the URL name used to build the install URL. */\n  get slug(): string {\n    return this.#slug;\n  }","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/factory/src/integrations/github/integration.ts#L332-L368","documentation":"The GithubIntegration constructor validates that all REQUIRED_FIELDS (appId, privateKey, clientId, clientSecret, slug) are present in the config. If any are missing or empty it throws immediately, instructing you to either supply the full GitHub App credentials or omit the integration entirely to disable GitHub-backed repositories.","triggerScenarios":"Constructing new GithubIntegration(config) with any of appId, privateKey, clientId, clientSecret, or slug undefined, null, or an empty string — typically from incomplete environment variables or partially loaded secrets.","commonSituations":"Missing env vars in CI/deployment (GITHUB_APP_ID etc. not set); secrets manager returned only some fields; PEM private key failed to load (empty string); enabling the integration in one environment but not configuring all credentials.","solutions":["Provide all five fields (appId, privateKey, clientId, clientSecret, slug) in the config object before constructing the integration","Check the missing field names listed in the message and fix the corresponding env vars/secret lookups","If GitHub-backed repositories are not needed, remove the integration from the factory config entirely so it is disabled rather than half-configured"],"exampleFix":"// before\nnew GithubIntegration({ appId: process.env.GITHUB_APP_ID }); // privateKey, clientId, clientSecret, slug missing\n// after\nnew GithubIntegration({\n  appId: process.env.GITHUB_APP_ID!,\n  privateKey: process.env.GITHUB_PRIVATE_KEY!,\n  clientId: process.env.GITHUB_CLIENT_ID!,\n  clientSecret: process.env.GITHUB_CLIENT_SECRET!,\n  slug: process.env.GITHUB_APP_SLUG!,\n});","handlingStrategy":"validation","validationCode":"const REQUIRED = ['appId', 'privateKey', 'clientId', 'clientSecret', 'slug'] as const;\nconst missing = REQUIRED.filter(f => !config[f]);\nif (missing.length) throw new Error(`GitHub App config incomplete: ${missing.join(', ')}`);","typeGuard":"function isGithubConfig(c: Partial<GithubIntegrationConfig>): c is GithubIntegrationConfig {\n  return Boolean(c.appId && c.privateKey && c.clientId && c.clientSecret && c.slug);\n}","tryCatchPattern":"try {\n  const gh = new GithubIntegration(config);\n} catch (e) {\n  if (e.message.startsWith('GithubIntegration: missing required config field(s)')) {\n    // surface which fields are missing; or omit the integration to disable it\n  } else throw e;\n}","preventionTips":["Fail fast at env loading: assert all GitHub App env vars exist before building the factory config","Keep credentials in one secrets object loaded atomically","Conditionally register the integration only when the full credential set is present"],"tags":["config","github","startup"],"backgroundTag":"missing-config-field","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}