guide
Debugging generated Bicep
Bicep diagnostics include a generated file path and line number. By default, Hulk removes temporary Bicep when check or plan finishes, including when the command fails. A failed transpile also removes its temporary output, leaving the previous .hulk/ directory untouched.
Keep generated artifacts
Add --keep-artifacts to inspect the exact files used by a command after it finishes:
hulk check ./main.json --env dev --require-bicep --keep-artifacts
hulk plan ./main.json --env dev --keep-artifacts
hulk plan ./main.json --env dev --what-if --keep-artifacts
hulk transpile ./main.json --env dev --require-bicep --keep-artifacts
Once rendering starts, Hulk prints an absolute directory path on standard output:
Keeping generated artifacts in: /path/to/project/..hulk.tmp-ABC123
Each run gets a separate directory beside .hulk/, relative to the directory where you ran Hulk. This can differ from the directory containing your input main.json. The directory contains main.bicep and any generated modules/ files. The path is printed even with --quiet; error output still follows --format json or --format sarif when selected.
| Command | Default behavior | With --keep-artifacts |
|---|---|---|
check |
Removes temporary output after success or failure | Keeps generated files after success or failure; does not replace .hulk/ |
plan, including --what-if |
Removes temporary output after success or failure | Keeps generated files after success or failure; does not replace .hulk/ |
transpile |
Publishes successful output to .hulk/; removes failed temporary output |
Also keeps the original temporary directory, so diagnostic paths remain valid after publishing |
The option preserves files; it does not suppress errors or change the command’s exit status. Failed parsing or Hulk validation happens before rendering, so those failures produce no artifact directory. If rendering itself fails, the retained directory can contain incomplete files.
Inspect a diagnostic
Open the printed main.bicep or the module named in the diagnostic, then go to its reported line. For example, main.bicep(89,4) refers to line 89, column 4 in that run’s generated file.
You can compile that same retained template independently:
bicep build /path/to/project/..hulk.tmp-ABC123/main.bicep --stdout
Use Bicep 0.35.1 or newer, as described in Installation. The compiler on PATH may differ from the compatible Azure CLI installation selected by Hulk.
Hulk’s local compilation discards compiled ARM JSON; --keep-artifacts retains the Bicep sources and modules. Fix the source Hulk JSON or the generator, then rerun the command to validate the change. Editing a retained file does not update your Hulk project.
Clean up after debugging
Retained directories are not cleaned up automatically. Delete the exact directory printed by Hulk when you have finished inspecting it. Keep these environment-specific generated files out of source control; this repository ignores ..hulk.tmp-*/ directories.