createsiteusers swallows ServerResponseError details, making failed rows unactionable

Open Beginner friendly
#468 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Start in tabcmd/commands/user/create_site_users.py:57-73 and trace how ServerResponseError is logged and added to error_list. Use the provided createsiteusers CSV scenario to inspect the resulting summary. Done means failed rows include actionable server response code, summary, or detail instead of only the exception class name.

Written by the indexing model from the issue text.

Description

Problem

When tabcmd createsiteusers fails on rows in the CSV, the summary just prints the exception class name — the actual server response (error code, detail message) never reaches the user, even at -l DEBUG or -l TRACE.

Repro

Any CSV that causes rows to fail. Example: a site that requires email-format usernames, given a CSV with non-email usernames like jsmith.

Output:

Lines processed: 4
Lines skipped: 4
Number of users added: 0
Error details:
['ServerResponseError', 'ServerResponseError', 'ServerResponseError', 'ServerResponseError']

The user can't tell whether the failures are invalid-license-level, invalid-email, duplicate-user, missing-permission, etc.

Root cause

tabcmd/commands/user/create_site_users.py:57-66 catches TSC.ServerResponseError and calls logger.debug(e) — but the underlying logger for CreateSiteUsersCommand has an effective level of INFO, so DEBUG calls are dropped. Even passing -l DEBUG doesn't surface them (verified — 21-line trace log shows no exception detail lines).

Additionally, only the exception class name is added to the error_list that's summarized at line 73. The commented-out fragment # + ": " + e.__cause__ or "Unknown" suggests someone previously considered including cause detail and pulled it out.

Suggested fix

At create_site_users.py:65, format the error's HTTP status / code / detail into the error_list entry alongside (or instead of) the class name. TSC's ServerResponseError exposes .code, .summary, and .detail — including these in the summary would make row failures actionable.

Optionally, bump the logger.debug(e) call at line 58 to logger.warning or logger.error so the exception surfaces without needing to increase log level.

Impact

Anyone hitting a row-level failure with createsiteusers (or the underlying UserCommand.add_users) currently has to open the source and inject their own logging to figure out what went wrong. Common failure modes (invalid email format on Cloud sites, wrong site role, duplicate user) all look identical in the output today.

Dominant language
Python
Stars
52
Forks
17
Avg merge
3d 8h
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tableau/tabcmd

All issues in tableau/tabcmd

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.