# Error: Unknown source type (Packer HCL source block)

## TL;DR
The label on your `source` block does not match a known builder. Use exactly one label and make it the builder type (e.g. `source "amazon-ebs" "my-image"`), not a custom name.

## The error

```
Error: Unknown source type

  on myimage/build.pkr.hcl line 5:
  (source code not available)

known builders: [null vsphere-iso qemu proxmox-iso linode tencentcloud-cvm
amazon-ebs vagrant proxmox-clone amazon-ebssurrogate profitbricks virtualbox-vm
vmware-iso azure-chroot oneandone proxmox amazon-instance amazon-ebsvolume ...]
```

## Fix it

1. Check your source block: it must read `source "[builder-type]" "[name]"` with exactly two labels, the first being a value from the `known builders` list.
   - Success check: `packer validate` passes the source block.
2. If you wrote `source "my-custom-name" {`, change it to `source "amazon-ebs" "my-custom-name" {` (builder type first, your name second).
   - Success check: the `Unknown source type` error disappears.
3. If you tried `labels = [...]`, remove it. Source blocks take labels positionally, not via a `labels` argument.
   - Success check: no more `Blocks of type "source" require 1 label(s)`.
4. Reference it in the build block as `sources = ["source.amazon-ebs.my-custom-name"]`.
   - Success check: `packer validate` succeeds end to end.

## When to use this
You hit this on `packer validate` or `packer build` with HCL templates where the source block label is wrong.

## When NOT to use this
Do not use this for `Failed to initialize build` (missing plugin) or JSON template errors. This is specifically the HCL source label mismatch.

## Compatibility
Packer 1.7+ with HCL templates. JSON templates use `"type": "amazon-ebs"` instead of labels.

## Variants
- `Blocks of type "source" require 1 label(s)` (tried to use a `labels` argument)
- `Error: Unknown source type` naming other builders

## Root cause
HCL source blocks are typed by their first label, which must be a registered builder. A custom name in the type position matches nothing, so Packer reports it as unknown and prints the full builder list.

## Edge cases
- Dynamic source blocks (generating sources programmatically) were not supported at the time of the issue; check current Packer docs if you need them.
- Parallel builds label output by source name; duplicate names across builds confuse the log stream.
