Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changes/unreleased/BUG FIXES-20260710-135409.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: BUG FIXES
body: Clarify the not-found (404) API error message to point at verifying the request path and resource IDs instead of suggesting an authentication problem.
time: 2026-07-10T13:54:09.690093-04:00
6 changes: 3 additions & 3 deletions internal/pkg/cmd/command_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ func (c *Command) Run(args []string, inv *Invocation) int {

func notFoundErrorHelp(io iostreams.IOStreams, hostname string) string {
return heredoc.New(io, heredoc.WithPreserveNewlines(), heredoc.WithWidth(0)).Mustf(`
Resource not found on {{ Bold "%s" }} or you are unauthorized to this action. Check your account permissions.
Resource or path not found on {{ Bold "%s" }}. Verify the API path and any resource IDs are correct.

{{ Bold "$ %s auth status" }}
`, hostname, version.Name)
If the path is correct, your token may not have permission to access this resource.
`, hostname)
}

// authErrorHelp returns a help message for recovering from authentication errors.
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/cmd/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestCommand_GlobalExitCode(t *testing.T) {
}{
{err: ErrDisplayHelp, expected: cli.RunResultHelp},
{err: ErrDisplayUsage, expected: 1},
{err: tfe.ErrNotFound, expected: 2, errContains: "Resource not found on app.test.terraform.io or you are unauthorized to this action"},
{err: tfe.ErrNotFound, expected: 2, errContains: "Resource or path not found on app.test.terraform.io. Verify the API path and any resource IDs are correct."},
{err: tfe.ErrUnauthorized, expected: 3, errContains: "tfctl auth login"},
{err: opErr, expected: 4, errContains: "network error"},
{err: tfe.ErrInternalServer, expected: 5, errContains: "Internal Server Error"},
Expand Down