{"record":{"id":"b59924aead395999","repo":"hashicorp/packer","slug":"the-url-must-be-specified","errorCode":null,"errorMessage":"the `url` must be specified","messagePattern":"the `url` must be specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"datasource/http/data.go","lineNumber":66,"sourceCode":"\tResponseHeaders map[string]string `mapstructure:\"request_headers\"`\n}\n\nfunc (d *Datasource) ConfigSpec() hcldec.ObjectSpec {\n\treturn d.config.FlatMapstructure().HCL2Spec()\n}\n\nfunc (d *Datasource) Configure(raws ...interface{}) error {\n\terr := config.Decode(&d.config, nil, raws...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar errs *packersdk.MultiError\n\n\tif d.config.Url == \"\" {\n\t\terrs = packersdk.MultiErrorAppend(\n\t\t\terrs,\n\t\t\tfmt.Errorf(\"the `url` must be specified\"))\n\t}\n\n\t// Default to GET if no method is specified\n\tif d.config.Method == \"\" {\n\t\td.config.Method = \"GET\"\n\t}\n\n\t// Check if the input is in the list of allowed methods\n\tvalidMethod := false\n\tallowedMethods := []string{\"HEAD\", \"GET\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\", \"PATCH\"}\n\tfor _, method := range allowedMethods {\n\t\tif method == d.config.Method {\n\t\t\tvalidMethod = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !validMethod {\n\t\terrs = packersdk.MultiErrorAppend(","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/datasource/http/data.go#L48-L84","documentation":"The http datasource validates its config in Configure and requires a `url` field. Because there is no URL to issue the HTTP request against, configuration fails immediately before any build work happens.","triggerScenarios":"Declaring an http datasource block whose `url` attribute is absent or set to an empty string \"\".","commonSituations":"Copy-pasted datasource block with the url left as a placeholder, an interpolated variable resolving to \"\", or the attribute simply forgotten.","solutions":["Add a valid `url` attribute to the http datasource block","Check that any variable/locals used in `url` are non-empty at evaluation time","Run `packer validate` to catch this before a build"],"exampleFix":"// before\ndatastore \"http\" \"release\" {\n}\n// after\ndatastore \"http\" \"release\" {\n  url = \"https://example.com/metadata.json\"\n}","handlingStrategy":"validation","validationCode":"// pre-validate datasource input in locals\nlocals { release_url = var.release_url != \"\" ? var.release_url : \"https://default.example.com/metadata.json\" }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `packer validate` in CI before builds","Never leave `url` as an empty placeholder; require it via variable validation","Set variable validation blocks: validation { condition = length(var.release_url) > 0 }"],"tags":["http","datasource","validation","config"],"backgroundTag":"missing-required-argument","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"}