different-ai/openwork · error · PluginArchRouteFailure

github_connector_account_required

github_connector_account_required

Error message

Connector account is not a GitHub account.

What it means

Thrown (409) by listGithubRepositories when the resolved connector account exists in the org but its `connectorType` is not "github". GitHub-specific listing (installation tokens, repo search) only works on GitHub accounts; the operation refuses to run against e.g. a google-drive or slack account.

Source

Thrown at ee/apps/den-api/src/routes/org/plugin-system/store.ts:7036

  return {
    autoImportNewPlugins: input.autoImportNewPlugins,
    createdMarketplace,
    connectorInstance: discovery.connectorInstance,
    connectorTarget: discovery.connectorTarget,
    createdPlugins: plugins,
    createdMappings: mappings,
    materializedConfigObjects,
    sourceRevisionRef: discovery.cache.sourceRevisionRef,
  }
}

export async function listGithubRepositories(input: { connectorAccountId: ConnectorAccountId; context: PluginArchActorContext; cursor?: string; limit?: number; q?: string }) {
  const account = await getConnectorAccountRow(input.context.organizationContext.organization.id, input.connectorAccountId)
  if (!account) {
    throw new PluginArchRouteFailure(404, "connector_account_not_found", "Connector account not found.")
  }
  if (account.connectorType !== "github") {
    throw new PluginArchRouteFailure(409, "github_connector_account_required", "Connector account is not a GitHub account.")
  }

  const installationId = Number(account.remoteId)
  if (!Number.isFinite(installationId) || installationId <= 0) {
    throw new PluginArchRouteFailure(409, "invalid_github_installation_id", "Connector account does not have a valid GitHub installation id.")
  }

  let repositories: RepositorySummary[]
  let installationSummary: Awaited<ReturnType<typeof getGithubInstallationSummary>>
  try {
    repositories = await listGithubInstallationRepositories({
      config: githubConnectorAppConfig(),
      installationId,
    })
    installationSummary = await getGithubInstallationSummary({
      config: githubConnectorAppConfig(),
      installationId,
    })

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Pass a connector account with connectorType === 'github' — filter the account list before calling.
  2. Use the type-appropriate listing API for non-GitHub accounts instead of listGithubRepositories.
  3. If the account's connectorType is wrong in the DB, correct it via the proper connector flow or a data migration.

Example fix

// before
await listGithubRepositories({ connectorAccountId: driveAccountId }) // google account -> 409
// after
const account = await getConnectorAccount(driveAccountId)
if (account.connectorType === 'github') {
  await listGithubRepositories({ connectorAccountId: account.id })
} else {
  await listConnectorResourcesForType(account)
}
Defensive patterns

Strategy: type-guard

Validate before calling

const account = await getConnectorAccount(connectorAccountId)
if (account.connectorType !== 'github') {
  throw new Error(`Account ${account.id} is a ${account.connectorType} account; use the ${account.connectorType} listing API`)
}

Type guard

function isGithubAccount(a: ConnectorAccountRow): a is ConnectorAccountRow & { connectorType: 'github' } { return a.connectorType === 'github' }

Try / catch

try {
  await listGithubRepositories({ connectorAccountId })
} catch (e) {
  if (e instanceof PluginArchRouteFailure && e.code === 'github_connector_account_required') {
    return listResourcesForConnectorType(account.connectorType, account.id)
  } else throw e
}

Prevention

When it happens

Trigger: Passing a non-GitHub connectorAccountId (Google Drive, Slack, etc.) to listGithubRepositories; an account row whose connectorType was changed or mis-seeded; UI bug routing the wrong account id to the GitHub repo picker.

Common situations: Generic connector UI iterating all accounts and calling the GitHub endpoint for each; data migrations relabeling connector types; combining multiple connector types in one settings page with a shared 'browse repos' action.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/8ab8d749d929847d. Report an issue: GitHub.