Skip to content

Fix/issue 510 improve error message#831

Open
TIMMAREDDYDEEKSHITHA-ship-it wants to merge 6 commits intomainfrom
fix/issue-510-improve-error-message
Open

Fix/issue 510 improve error message#831
TIMMAREDDYDEEKSHITHA-ship-it wants to merge 6 commits intomainfrom
fix/issue-510-improve-error-message

Conversation

@TIMMAREDDYDEEKSHITHA-ship-it
Copy link
Collaborator

@TIMMAREDDYDEEKSHITHA-ship-it TIMMAREDDYDEEKSHITHA-ship-it commented Mar 12, 2026

Description
Fixes #510

Problem

Users were confused by the unclear error "no templates were rendered by the renderer process run" when their pack lacked .nomad.tpl files. This led to hours of debugging, as reported in the issue.

Solution

Enhanced the error message to:

  • Clearly explain that .nomad.tpl files are required for parent templates
  • Show the complete template naming convention with examples
  • List the actual template files found in the pack's templates directory
  • Provide actionable guidance on how to fix the issue

Changes

  • Added ErrNoParentTemplates error constant in internal/pkg/errors/ui_context.go
  • Updated error handling in plan command (internal/cli/plan.go)
  • Updated error handling in run command (internal/cli/run.go)
  • Both commands now read the filesystem to show users which files exist

pack renders successfully with .nomad.tpl file

image

Reproducing the error ->
File structure after renaming (missing .nomad.tpl)

image

After: Improved Error Message ->
Running nomad-pack plan now shows clear, actionable error

image

Reminders

  • Add CHANGELOG.md entry
  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Copy link
Member

@hashi-divyansh hashi-divyansh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TIMMAREDDYDEEKSHITHA-ship-it Added my comment.
Missing implementation for render cmd.

@TIMMAREDDYDEEKSHITHA-ship-it
Copy link
Collaborator Author

@TIMMAREDDYDEEKSHITHA-ship-it Added my comment. Missing implementation for render cmd.

here 'render' command has different behaviour - it succeeds if it renders either parent templates or dependent pack templates. Since it has different validation logic, I kept existing generic error message for it.

The improved error message specifically addresses issue in #510 which affects 'plan' and 'run' commands where parent templates are strictly required

- Add nomadVariable() function to retrieve specific variable
- Add nomadVariables() function to list all variables
- Add comprehensive unit tests with mocked API
- Verify integration with live Nomad cluster
- Update documentation with usage examples

Closes #409
- Added ErrNoParentTemplates error constant
- Enhanced error message to explain .nomad.tpl naming requirement
- Shows template naming convention rules with examples
- Lists actual template files found in templates/ directory
- Provides specific guidance on how to fix the issue
- Applied to both plan and run commands for consistency

The new error message clearly shows users:
1. What went wrong (no .nomad.tpl files)
2. The naming convention rules
3. Which files exist that need renaming
4. How to fix the issue

This replaces the previous unclear 'no templates were rendered' error
that left users confused for hours.

Fixes #510
@TIMMAREDDYDEEKSHITHA-ship-it TIMMAREDDYDEEKSHITHA-ship-it force-pushed the fix/issue-510-improve-error-message branch from f3b90f3 to 5a56c0b Compare March 16, 2026 17:46
@TIMMAREDDYDEEKSHITHA-ship-it TIMMAREDDYDEEKSHITHA-ship-it marked this pull request as ready for review March 17, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nomad-pack throws obtuse error when pack does not contain a parent template

2 participants