badges/shields · warning · NotFound

unknown build state

Error message

unknown build state

What it means

The Copr service maps the latest build's `state` through stateStatusMap; if the state string is not in the map, NotFound with 'unknown build state' is thrown. This guards against Copr introducing new or unexpected build states the badge does not recognize.

Source

Thrown at services/copr/copr.service.js:104

      options: {
        searchParams: {
          ownername: owner,
          projectname: project,
          packagename: packageName,
          with_latest_build: 'True',
        },
      },
      httpErrors: {
        404: 'project or package not found',
      },
    })
  }

  transform({ builds }) {
    const { state } = builds.latest
    const status = stateStatusMap[state]
    if (!status) {
      throw new NotFound({ prettyMessage: 'unknown build state' })
    }
    return { status }
  }

  async handle(
    { owner, project, package: packageName },
    { baseUrl = 'https://copr.fedorainfracloud.org' },
  ) {
    const json = await this.fetch({
      baseUrl,
      owner,
      project,
      package: packageName,
    })
    const { status } = this.transform(json)
    return this.constructor.render({ status })
  }
}

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Check the latest build's state for this project in the Copr web UI and see which value it reports
  2. Retry later — the build may transition to a standard state (succeeded/failed/canceled)
  3. Update the service's stateStatusMap to include the new Copr state if you run a fork
  4. Open an issue with the badge service so the new state value can be mapped
Defensive patterns

Strategy: fallback

Validate before calling

const KNOWN_STATES = ['succeeded','failed','canceled','starting','importing','running','waiting'];
if (latestBuild && !KNOWN_STATES.includes(latestBuild.state)) console.warn(`unrecognized Copr state: ${latestBuild.state}`);

Type guard

function hasKnownState(build, map) { return build?.state != null && map[build.state] != null; }

Try / catch

try {
  const badge = await fetchBadge(`/copr/build/${owner}/${project}/${pkg}`);
} catch (e) {
  if (e.status === 404 && e.message.includes('unknown build state')) console.warn('Copr reports a state the badge does not map — check upstream');
  else throw e;
}

Prevention

When it happens

Trigger: transform({ builds }) reads builds.latest.state and the value is absent from stateStatusMap — e.g. a newly added Copr build state, a null/undefined state, or an unexpected API payload.

Common situations: Copr API adding a new state value after a platform update, projects whose latest build is in a transient/unusual state, or malformed API responses where builds.latest is null.

Related errors


AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30). Data as JSON: /api/errors/c13d190560f5ec86. Report an issue: GitHub.