hashicorp/packer · error

No files specified in artifice configuration

Error message

No files specified in artifice configuration

What it means

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.

Source

Thrown at post-processor/artifice/post-processor.go:55

}

func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapstructure().HCL2Spec() }

func (p *PostProcessor) Configure(raws ...interface{}) error {
	err := config.Decode(&p.config, &config.DecodeOpts{
		PluginType:         "artifice",
		Interpolate:        true,
		InterpolateContext: &p.config.ctx,
		InterpolateFilter: &interpolate.RenderFilter{
			Exclude: []string{},
		},
	}, raws...)
	if err != nil {
		return err
	}

	if len(p.config.Files) == 0 {
		return fmt.Errorf("No files specified in artifice configuration")
	}

	return nil
}

func (p *PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packersdk.Artifact) (packersdk.Artifact, bool, bool, error) {
	if len(artifact.Files()) > 0 {
		ui.Say(fmt.Sprintf("Discarding files from artifact: %s", strings.Join(artifact.Files(), ", ")))
	}

	artifact, err := NewArtifact(p.config.Files)
	ui.Say(fmt.Sprintf("Using these artifact files: %s", strings.Join(artifact.Files(), ", ")))

	return artifact, true, false, err
}

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Add the intended file paths to the artifice `files` attribute
  2. Confirm the attribute is spelled `files` and is not shadowed/overridden to empty by variables or overrides
  3. Check the merged result (e.g. packer validate) to ensure variable interpolation doesn't yield an empty list

Example fix

// before
post-processor "artifice" {
  files = []
}
// after
post-processor "artifice" {
  files = ["output/result.tar.gz"]
}
Defensive patterns

Strategy: validation

Validate before calling

# HCL2: assert the files list is non-empty before running
locals {
  artifice_files = ["output/result.tar.gz"]
}
# packer validate will surface the artifice error; guard in CI:
# test ${#ARTIFICE_FILES[@]} -gt 0

Try / catch

if err := pp.Configure(raws); err != nil {
    if strings.Contains(err.Error(), "No files specified in artifice configuration") {
        // fix template: add files = [...] to the artifice block
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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`).

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


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