Skip to content

Conversation

@shihanpan
Copy link
Collaborator

@shihanpan shihanpan commented Jan 6, 2026

Summary

Improves the error message for 401 Unauthorized errors to clearly indicate both possible causes (invalid token OR insufficient permissions) and provide a link to documentation for resolving auth/permission issues.

Changes

  • Enhanced _handle_auth_error() in exception_handler.py to clarify that 401 errors can be due to:
    • Invalid or expired API token
    • API client lacking required permissions for the operation
  • Added direct link to Workato API client management documentation: https://docs.workato.com/api-mgmt/api-client-mgmt.html
  • Restructured error message with clear sections: causes and resolution steps

Why

Users encountering 401 errors were receiving a message that only mentioned invalid tokens. However, 401 errors can also occur when the API key is valid but lacks sufficient permissions. This improvement makes the error more accurate and actionable.

Testing

  • Error message displays both auth scenarios
  • Documentation link is correct and accessible
  • JSON output mode still works correctly

Related

  • DEVP-822: Documents the broader issue of resource not found errors

🤖 Generated with Claude Code

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py68494%10–11, 69–70
cli
   __init__.py52394%49, 51, 60
   containers.py270100% 
cli/commands
   __init__.py00100% 
   api_clients.py291996%27, 302, 448–449, 483, 493, 584, 615, 623
   api_collections.py257398%28, 183, 347
   assets.py47295%55–56
   connections.py526599%591, 593, 599, 637, 988
   data_tables.py165596%31, 253, 267, 321–322
   guide.py166199%106
   init.py1070100% 
   profiles.py2030100% 
   properties.py97198%21
   pull.py172298%193–194
   workspace.py39294%61, 71
cli/commands/connectors
   __init__.py00100% 
   command.py90297%110, 159
   connector_manager.py203498%176, 292, 300–301
cli/commands/projects
   __init__.py00100% 
   command.py2721096%359–362, 373, 439–441, 491, 495
   project_manager.py166795%48, 66, 263–264, 276, 317, 325
cli/commands/push
   __init__.py00100% 
   command.py133496%109, 112, 230, 308
cli/commands/recipes
   __init__.py00100% 
   command.py427997%117, 133–134, 272–275, 403, 709
   validator.py7062097%174, 883, 1136, 1223, 1246, 1279, 1281–1282, 1359–1361, 1457–1458, 1517–1518, 1707–1708, 1736–1738
cli/utils
   __init__.py40100% 
   exception_handler.py3272791%134–135, 140–141, 143–144, 174–175, 181, 184–185, 228, 283, 311, 338, 395, 430, 489, 491–492, 497–498, 500–504
   gitignore.py140100% 
   ignore_patterns.py230100% 
   spinner.py430100% 
   token_input.py451762%70, 98, 100, 102–104, 107, 124, 127–128, 132–133, 136, 139–140, 142, 144
   version_checker.py135695%24, 26, 33–34, 72, 102
cli/utils/config
   __init__.py50100% 
   manager.py5443493%127, 138, 149, 157–159, 162, 165, 177, 227–228, 399, 417, 421, 424–427, 443, 464, 478, 491, 533, 574, 652–653, 690, 904, 1047–1048, 1062–1063, 1119, 1178
   models.py330100% 
   profiles.py3091096%93, 189–190, 193, 228–230, 255–257
   workspace.py680100% 
TOTAL576418796% 

@shihanpan shihanpan force-pushed the DEVP-660-improve-api-client-error-messages branch 2 times, most recently from 3192c96 to 53e638b Compare January 7, 2026 00:27
Add optional last_seen field to User model and update API spec
@shihanpan shihanpan force-pushed the DEVP-660-improve-api-client-error-messages branch from 53e638b to 59c16d6 Compare January 7, 2026 00:47
    - Clarify that 401 errors can be due to invalid/expired API token OR insufficient permissions
    - Add direct link to Workato API client management documentation
    - Restructure error message to show both possible causes and resolution steps
    - Improve actionability of error message for users debugging auth issues

    🤖 Generated with [Claude Code](https://claude.com/claude-code)

    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@shihanpan shihanpan closed this Jan 7, 2026
@shihanpan shihanpan deleted the DEVP-660-improve-api-client-error-messages branch January 7, 2026 19:47
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.

3 participants