hcengineering/platform · error · PlatformError

No status found for GH issue status ${pr.state} ${pr.stateRe

Error message

No status found for GH issue status ${pr.state} ${pr.stateReason}

What it means

During GitHub issue/PR sync, guessStatus maps a GitHub issue state (open/closed) plus stateReason to an internal project status (done, unstarted, todo, active, etc.). If every mapping helper returns undefined — i.e. the workspace's project statuses contain none of the recognized statuses — this unknownStatus PlatformError is thrown with the GH state and stateReason embedded.

Source

Thrown at services/github/pod-github/src/sync/utils.ts:207

  const canceled = (): Status | undefined => statuses.find((it) => it.category === task.statusCategory.Lost)
  const completed = (): Status | undefined => statuses.find((it) => it.category === task.statusCategory.Won)

  let result: IssueStatus | undefined

  if (pr.state === 'OPEN' && pr.stateReason == null) {
    result = unstarted() ?? todo() ?? active()
  } else if (pr.state === 'OPEN' && pr.stateReason === GithubIssueStateReason.Reopened) {
    result = active()
  } else if (pr.state === 'CLOSED' && pr.stateReason === GithubIssueStateReason.NotPlanned) {
    result = canceled()
  } else if (pr.state === 'CLOSED' || pr.state === 'MERGED') {
    result = completed()
  } else {
    // By default put into backlog
    result = unstarted() ?? todo() ?? active()
  }
  if (result === undefined) {
    throw new PlatformError(unknownStatus(`No status found for GH issue status ${pr.state} ${pr.stateReason}`))
  }
  return result
}

/**
 * @public
 */
export class SyncRunner {
  eventSync = new Map<string, Promise<void>>()

  async exec<T>(id: string, op: () => Promise<T>): Promise<T> {
    await this.eventSync.get(id)
    const promise = op()
    this.eventSync.set(
      id,
      promise.then(() => {})
    )
    try {

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Add/restore the standard statuses (done/todo/in-progress/backlog or the ones the mapper recognizes) to the target project.
  2. Check the sync target project's status configuration and rename custom statuses back to recognized defaults.
  3. Catch the error per-issue so one unmappable issue doesn't abort the whole sync, and inspect its state/stateReason values.
  4. Update the mapper or project template if new GitHub stateReason values need support.

Example fix

// before
const status = guessStatus(pr, statuses) // throws if none match
// after
try {
  const status = guessStatus(pr, statuses)
} catch (err) {
  console.warn(`Unmapped GH status ${pr.state}/${pr.stateReason}, defaulting to backlog`)
  const status = unstarted() ?? statuses[0]
}
Defensive patterns

Strategy: try-catch

Validate before calling

const recognized = statuses.some(s => ['done', 'todo', 'unstarted', 'active', 'backlog'].includes(s.name))
if (!recognized) {
  console.warn('Project statuses unrecognized by GH mapper; sync may fail')
}

Type guard

function hasMappableStatus(statuses: Status[]): boolean {
  return statuses.some(s => s.ofCategory !== undefined) && statuses.length > 0
}

Try / catch

try {
  status = guessStatus(pr, statuses)
} catch (err) {
  if (err.message.includes('No status found for GH issue status')) {
    console.warn(`Defaulting to first status for ${pr.state}/${pr.stateReason}`)
    status = unstarted() ?? statuses[0]
  } else throw err
}

Prevention

When it happens

Trigger: Syncing a GitHub issue whose state/stateReason combination (e.g. closed with an unusual stateReason, or state 'all'/'unknown' from an API response) cannot be matched, in a project whose status list lacks the standard done/todo/backlog/in-progress statuses.

Common situations: Projects created with a customized status set (renamed/deleted default statuses) so no recognized status matches; syncing into a bare or misconfigured project; GitHub API returning unexpected stateReason values; partially-initialized projects missing statuses.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/27bed10fc01d3e8e. Report an issue: GitHub.