Skip to content

Reword 404 "not found" error help - #77

Merged
shwetamurali merged 2 commits into
mainfrom
shweta/auth_msg
Jul 13, 2026
Merged

Reword 404 "not found" error help#77
shwetamurali merged 2 commits into
mainfrom
shweta/auth_msg

Conversation

@shwetamurali

Copy link
Copy Markdown
Collaborator

Description

Reword the 404 "not found" error help so it no longer conflates "resource/path not found" with an authentication/authorization problem.

A customer reported their LLM-driven agent thrashing when driving tfctl api. Reviewing the trace, the agent repeatedly hit 404s on paths that don't exist (e.g. no-code module sub-endpoints) and interpreted the error as an auth failure because the message led with "or you are unauthorized" and nudged toward tfctl auth status. That sent it down a token/credentials/curl debugging path instead of correcting the endpoint, costing many extra iterations.

The 404 case (tfe.ErrNotFound) is already cleanly separated from real 401s (tfe.ErrUnauthorized, which keeps its own auth login help), so this is purely a wording fix. The new message leads with the actual cause which is a wrong path/ID while still honestly noting that HCP/TFE can return 404 for resources the token can't see, without steering toward auth tooling.

Example Output

Before:

Resource not found on <host> or you are unauthorized to this action. Check your account permissions.

$ tfctl auth status

After:

Resource or path not found on <host>. Verify the API path and any resource IDs are correct.

If the path is correct, your token may not have permission to access this resource.

PR Checklist

  • Run npx changie new or install changie to prepare a new changelog entry for the next set of release notes.
  • Ensure any command changes are sensitive to these global flags:
    • --json — Force machine readable output to stdout. Does not apply to stderr.
    • --markdown — Force markdown output to stdout. Does not apply to stderr.
    • --dry-run — Don't make any actual writes or other mutations. Describe what would have changed to stderr.
    • --quiet — Don't render output to stdout.
  • Get the logging interface from the context and add debug logging for interesting conditions and nonfatal situations.
  • Run make gen/screenshot if the root command output changes.
  • Add the Autocomplete field to positional arguments and flags to assist shell autocomplete.

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@shwetamurali
shwetamurali marked this pull request as ready for review July 10, 2026 17:54
@shwetamurali shwetamurali changed the title reword Reword 404 "not found" error help Jul 10, 2026
@shwetamurali
shwetamurali merged commit 6cc02ee into main Jul 13, 2026
2 checks passed
@shwetamurali
shwetamurali deleted the shweta/auth_msg branch July 13, 2026 15:24
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.

2 participants