nodejs/node · error · Error
project-id is required
Error message
project-id is required
What it means
Thrown by the CircleCI trust provider's `flagsToOptions` when the `--project-id` flag is missing or empty. The project UUID is required to scope the trust record to a specific CircleCI project.
Source
Thrown at deps/npm/lib/commands/trust/circleci.js:132
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) {
this.validateUuid(contextId, 'context-id')
}
}View on GitHub (pinned to 1b2de5e052)
Solutions
- Pass `--project-id <uuid>` with the CircleCI project UUID.
- Obtain it from CircleCI Project Settings; it must be a UUID (`validateUuid` runs next).
- Distinguish org-id (organization level) from project-id (repository level).
Example fix
// before npm trust circleci mypkg --org-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, 'project-id') Type guard
function hasProjectId(flags) {
return Boolean(flags && flags['project-id'])
} Prevention
- Distinguish project-id (repo-level) from org-id (org-level).
- Source both from CircleCI's settings UI as UUIDs.
- Validate flag presence in a preflight wrapper.
When it happens
Trigger: `flags['project-id']` is falsy during required-flag validation (checked after org-id).
Common situations: Mixing up org-id and project-id; omitting the flag; passing the project slug instead of its UUID.
Related errors
- org-id is required
- pipeline-definition-id is required
- vcs-origin is required
- vcs-origin must not include a scheme (e.g., use 'github.com/
- vcs-origin must be in format 'provider/owner/repo'
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/4b475cd4c0a41715.
Report an issue: GitHub.