nodejs/node · error · Error

org-id is required

Error message

org-id is required

What it means

Thrown by the CircleCI trust provider's `flagsToOptions` when the `--org-id` flag is missing or empty. The CircleCI organization UUID is a required binding for the trust record.

Source

Thrown at deps/npm/lib/commands/trust/circleci.js:129

  // Override flagsToOptions since CircleCI doesn't use file/entity pattern
  async flagsToOptions ({ positionalArgs, flags }) {
    const content = await this.optionalPkgJson()
    const pkgName = positionalArgs[0] || content.name

    if (!pkgName) {
      throw new Error('Package name must be specified either as an argument or in package.json file')
    }

    const orgId = flags['org-id']
    const projectId = flags['project-id']
    const pipelineDefinitionId = flags['pipeline-definition-id']
    const vcsOrigin = flags['vcs-origin']
    const contextIds = flags['context-id']

    // Validate required flags
    if (!orgId) {
      throw new Error('org-id is required')
    }
    if (!projectId) {
      throw new Error('project-id is required')
    }
    if (!pipelineDefinitionId) {
      throw new Error('pipeline-definition-id is required')
    }
    if (!vcsOrigin) {
      throw new Error('vcs-origin is required')
    }

    // Validate formats
    this.validateUuid(orgId, 'org-id')
    this.validateUuid(projectId, 'project-id')
    this.validateUuid(pipelineDefinitionId, 'pipeline-definition-id')
    this.validateVcsOrigin(vcsOrigin)
    if (contextIds?.length > 0) {
      for (const contextId of contextIds) {

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Pass `--org-id <uuid>` with the CircleCI organization UUID.
  2. Find it in CircleCI under Organization Settings; it must be a valid UUID (also validated by `validateUuid`).
  3. Store it in CI secrets and interpolate it into the command.

Example fix

// before
npm trust circleci mypkg --project-id <uuid> ...
// after
npm trust circleci mypkg --org-id <uuid> --project-id <uuid> ...
Defensive patterns

Strategy: validation

Validate before calling

function assertRequiredFlag(flags, name) {
  if (!flags[name]) throw new Error(`${name} is required`)
  return flags[name]
}
assertRequiredFlag(flags, 'org-id')

Type guard

function hasOrgId(flags) {
  return Boolean(flags && flags['org-id'])
}

Prevention

When it happens

Trigger: `flags['org-id']` is falsy when `flagsToOptions` runs its required-flag validation block.

Common situations: Forgetting the flag; copying a project id but not the org id; CI template that omits the org-level identifier.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/8c49c44b692e1cf3. Report an issue: GitHub.