{"record":{"id":"17abe6feace6c5d3","repo":"hashicorp/packer","slug":"no-files-specified-in-artifice-configuration","errorCode":null,"errorMessage":"No files specified in artifice configuration","messagePattern":"No files specified in artifice configuration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"post-processor/artifice/post-processor.go","lineNumber":55,"sourceCode":"}\n\nfunc (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapstructure().HCL2Spec() }\n\nfunc (p *PostProcessor) Configure(raws ...interface{}) error {\n\terr := config.Decode(&p.config, &config.DecodeOpts{\n\t\tPluginType:         \"artifice\",\n\t\tInterpolate:        true,\n\t\tInterpolateContext: &p.config.ctx,\n\t\tInterpolateFilter: &interpolate.RenderFilter{\n\t\t\tExclude: []string{},\n\t\t},\n\t}, raws...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(p.config.Files) == 0 {\n\t\treturn fmt.Errorf(\"No files specified in artifice configuration\")\n\t}\n\n\treturn nil\n}\n\nfunc (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packersdk.Artifact) (packersdk.Artifact, bool, bool, error) {\n\tif len(artifact.Files()) > 0 {\n\t\tui.Say(fmt.Sprintf(\"Discarding files from artifact: %s\", strings.Join(artifact.Files(), \", \")))\n\t}\n\n\tartifact, err := NewArtifact(p.config.Files)\n\tui.Say(fmt.Sprintf(\"Using these artifact files: %s\", strings.Join(artifact.Files(), \", \")))\n\n\treturn artifact, true, false, err\n}\n","sourceCodeStart":37,"sourceCodeEnd":71,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/post-processor/artifice/post-processor.go#L37-L71","documentation":"Configuration-time validation for the artifice post-processor: it refuses to configure when the required `files` list is empty. Artifice's whole purpose is to extract specific files from the builder's output, so an empty list makes the post-processor meaningless and is rejected up front.","triggerScenarios":"Configuring post-processor \"artifice\" with no `files` entries, e.g. an HCL2 post-processor block with files = [] or omitted entirely, or a JSON template with \"files\": [] — Configure() sees len(p.config.Files) == 0 and returns this error before any build runs.","commonSituations":"Copy-pasting an artifice block and forgetting to fill in files; templating that expands to an empty list; HCL attribute commented out or mistyped (e.g. `file` instead of `files`).","solutions":["Add the intended file paths to the artifice `files` attribute","Confirm the attribute is spelled `files` and is not shadowed/overridden to empty by variables or overrides","Check the merged result (e.g. packer validate) to ensure variable interpolation doesn't yield an empty list"],"exampleFix":"// before\npost-processor \"artifice\" {\n  files = []\n}\n// after\npost-processor \"artifice\" {\n  files = [\"output/result.tar.gz\"]\n}","handlingStrategy":"validation","validationCode":"# HCL2: assert the files list is non-empty before running\nlocals {\n  artifice_files = [\"output/result.tar.gz\"]\n}\n# packer validate will surface the artifice error; guard in CI:\n# test ${#ARTIFICE_FILES[@]} -gt 0","typeGuard":null,"tryCatchPattern":"if err := pp.Configure(raws); err != nil {\n    if strings.Contains(err.Error(), \"No files specified in artifice configuration\") {\n        // fix template: add files = [...] to the artifice block\n    }\n    return err\n}","preventionTips":["Always populate `files` when using the artifice post-processor","Run packer validate before every build to catch empty config early","Avoid variable interpolation that can expand to an empty list","Check for attribute typos (files vs file) when copying templates"],"tags":["packer","post-processor","artifice","config-validation"],"backgroundTag":"missing-required-config","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"}