hashicorp/packer · error

cannot modify status of DONE build %s

Error message

cannot modify status of DONE build %s

What it means

HCP registry guard from Bucket.UpdateBuildStatus: the target build is already DONE and HCP does not allow modifying a completed build's status, so the update is rejected to avoid corrupting the finished build.

Source

Thrown at internal/hcp/registry/types.bucket.go:280

// For updating a build status to DONE use CompleteBuild.
func (bucket *Bucket) UpdateBuildStatus(
	ctx context.Context, name string, status hcpPackerModels.HashicorpCloudPacker20230101BuildStatus,
) error {
	if status == hcpPackerModels.HashicorpCloudPacker20230101BuildStatusBUILDDONE {
		return fmt.Errorf("do not use UpdateBuildStatus for updating to DONE")
	}

	buildToUpdate, err := bucket.Version.Build(name)
	if err != nil {
		return err
	}

	if buildToUpdate.ID == "" {
		return fmt.Errorf("the build for the component %q does not have a valid id", name)
	}

	if buildToUpdate.Status == hcpPackerModels.HashicorpCloudPacker20230101BuildStatusBUILDDONE {
		return fmt.Errorf("cannot modify status of DONE build %s", name)
	}

	_, err = bucket.client.UpdateBuild(ctx,
		bucket.Name,
		bucket.Version.Fingerprint,
		buildToUpdate.ID,
		buildToUpdate.RunUUID,
		"",
		"",
		"",
		"",
		nil,
		status,
		nil,
		nil,
	)
	if err != nil {
		return err

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Skip status updates for builds already marked DONE
  2. Create a new version/fingerprint for further changes instead of mutating the completed build
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/hcp/registry/types.bucket.go:280 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05). Data as JSON: /api/errors/98e54104c9010f77. Report an issue: GitHub.