thoughtspot / thoughtspot/cs_tools

ts-ai-stats syncer fails with ValidationError: query_end_time when a query has no end timestamp

Open
#354 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
2
Forks
7
PR merge metrics
No merged PRs in 30d

Description

First Stop
  • I have read and agreed to the ThoughtSpot LICENSE.
  • I understand that if I have a critical issue with ThoughtSpot, I should reach out to my designated Account Executive and Customer Success Manager instead of cs_tools.
Platform Configuration
Image
Description

I am getting error when trying to sync ts-ai-stats.

Command:
cs_tools tools searchable ts-ai-stats --config TS_PRD --syncer "excel://filepath=ts_ai_stats.xlsx" --from-date "2026-08-03" --to-date "2026-08-03"

Issue
Command fails with:

ValidationError: 1 validation error for AIStats
query_end_time
Input should be a valid datetime [type=datetime_type, input_value=None, input_type=NoneType]

Same command with --from-date "2026-08-01" --to-date "2026-08-01" succeeds. Appears to be triggered by a specific record on 2026-08-03 where the underlying query never got an end timestamp (likely an interrupted/cancelled/errored query).

Considering adding a log file.

[DEBUG - 2026-08-19T18:25:28+0100] [cs_tools.cli.custom_types - custom_types.convert 182] Registering syncer: excel
[DEBUG - 2026-08-19T18:25:28+0100] [cs_tools.sync.base - base.ensure_pip_requirements 76] Processing requirement: openpyxl>=3.1.5
[DEBUG - 2026-08-19T18:25:28+0100] [cs_tools.updater._updater - _updater.install 281] Attempting to install 'openpyxl>=3.1.5' into the virtual environment.
[DEBUG - 2026-08-19T18:25:28+0100] [cs_tools.updater._updater - _updater.run 145] Using Python 3.9.25 environment at: .config/cs_tools/.cs_tools
[DEBUG - 2026-08-19T18:25:28+0100] [cs_tools.updater._updater - _updater.run 145] Audited 1 package in 2ms
[DEBUG - 2026-08-19T18:25:28+0100] [cs_tools.sync.base - base.ensure_pip_requirements 76] Processing requirement: lxml>=5.3.1
[DEBUG - 2026-08-19T18:25:28+0100] [cs_tools.updater._updater - _updater.install 281] Attempting to install 'lxml>=5.3.1' into the virtual environment.
[DEBUG - 2026-08-19T18:25:28+0100] [cs_tools.updater._updater - _updater.run 145] Using Python 3.9.25 environment at: .config/cs_tools/.cs_tools
[DEBUG - 2026-08-19T18:25:28+0100] [cs_tools.updater._updater - _updater.run 145] Audited 1 package in 8ms
[INFO - 2026-08-19T18:25:28+0100] [cs_tools.cli.custom_types - custom_types.convert 193] Initializing syncer: Excel
[ERROR - 2026-08-19T18:25:28+0100] [cs_tools.cli.commands.main - main.run 86] Invalid value for '--from-date': Invalid format, please use YYYY-MM-DD
[DEBUG - 2026-08-19T18:25:28+0100] [cs_tools.cli.commands.main - main.run 87] More info..
Traceback (most recent call last):
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/cs_tools/cli/custom_types.py", line 109, in convert
date = dt.date.fromisoformat(value)
ValueError: Invalid isoformat string: '2026-8-3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/cs_tools/cli/commands/main.py", line 77, in run
return_code = app(standalone_mode=False)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/typer/main.py", line 326, in call
raise e
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/typer/main.py", line 309, in call
return get_command(self)(*args, **kwargs)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/typer/core.py", line 723, in main
return _main(
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/typer/core.py", line 193, in _main
rv = self.invoke(ctx)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/core.py", line 1686, in invoke
sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/core.py", line 943, in make_context
self.parse_args(ctx, args)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/core.py", line 1408, in parse_args
value, args = param.handle_parse_result(ctx, opts, args)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/core.py", line 2400, in handle_parse_result
value = self.process_value(ctx, value)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/core.py", line 2356, in process_value
value = self.type_cast_value(ctx, value)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/core.py", line 2344, in type_cast_value
return convert(value)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/core.py", line 2316, in convert
return self.type(value, param=self, ctx=ctx)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/types.py", line 83, in call
return self.convert(value, param, ctx)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/cs_tools/cli/custom_types.py", line 111, in convert
self.fail(message="Invalid format, please use YYYY-MM-DD", param=param, ctx=ctx)
File "/home/admin.rquaresma/.config/cs_tools/.cs_tools/lib64/python3.9/site-packages/click/types.py", line 136, in fail
raise BadParameter(message, ctx=ctx, param=param)
click.exceptions.BadParameter: Invalid format, please use YYYY-MM-DD

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.

Research direction

Start by reproducing the ts-ai-stats command for the date that contains a record without a query end timestamp, then trace where that record becomes an AIStats object and raises ValidationError. Done means the sync no longer aborts on a missing query_end_time and the affected record is handled consistently; add or update a regression test if the existing test structure identifies where this behavior belongs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.