{"record":{"id":"03c0fcdb20ec829e","repo":"hashicorp/packer","slug":"bitbucket-build-number-environment-variable-not-fo","errorCode":null,"errorMessage":"BITBUCKET_BUILD_NUMBER environment variable not found","messagePattern":"BITBUCKET_BUILD_NUMBER environment variable not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/hcp/registry/metadata/cicd.go","lineNumber":95,"sourceCode":"\tfor _, key := range keys {\n\t\tif value, ok := os.LookupEnv(key); ok {\n\t\t\tenv[key] = value\n\t\t}\n\t}\n\n\treturn env\n}\n\nfunc (g *GitlabCI) Type() string {\n\treturn \"gitlab\"\n}\n\ntype BitbucketPipelines struct{}\n\nfunc (b *BitbucketPipelines) Detect() error {\n\t_, ok := os.LookupEnv(\"BITBUCKET_BUILD_NUMBER\")\n\tif !ok {\n\t\treturn fmt.Errorf(\"BITBUCKET_BUILD_NUMBER environment variable not found\")\n\t}\n\treturn nil\n}\n\nfunc (b *BitbucketPipelines) Details() map[string]interface{} {\n\tenv := make(map[string]interface{})\n\tkeys := []string{\n\t\t\"BITBUCKET_REPO_FULL_NAME\",\n\t\t\"BITBUCKET_REPO_UUID\",\n\t\t\"BITBUCKET_WORKSPACE\",\n\t\t\"BITBUCKET_COMMIT\",\n\t\t\"BITBUCKET_BRANCH\",\n\t\t\"BITBUCKET_TAG\",\n\t\t\"BITBUCKET_BUILD_NUMBER\",\n\t\t\"BITBUCKET_PIPELINE_UUID\",\n\t\t\"BITBUCKET_STEP_UUID\",\n\t\t\"BITBUCKET_DEPLOYMENT_ENVIRONMENT\",\n\t\t\"BITBUCKET_PR_ID\",","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/internal/hcp/registry/metadata/cicd.go#L77-L113","documentation":"Probe result from the Bitbucket Pipelines detector (BitbucketPipelines.Detect): the BITBUCKET_BUILD_NUMBER env var is absent, so the process is not running inside Bitbucket Pipelines and this metadata provider does not apply.","triggerScenarios":"Thrown at internal/hcp/registry/metadata/cicd.go:95 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Expected negative detection; try the next CI provider in the chain","Run the build inside a Bitbucket Pipeline if its metadata is required"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}