Skip to content

[Crash] OmnigentError: {'error_code': 403, 'message': 'Invalid access token. [ReqId: 145ae51b-da74-40a7-ac56-0ad190834faf]'} #3231

Description

@matthewmoorcroft

Description

This crash was auto-reported by Omnigent's crash handler.

Exception: OmnigentError: {'error_code': 403, 'message': 'Invalid access token. [ReqId: 145ae51b-da74-40a7-ac56-0ad190834faf]'}

Command:

/Users/matthew.moorcroft/.local/bin/omnigent

Traceback:

Traceback (most recent call last):
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/omnigent/cli.py", line 1669, in main
    cli(args=argv, standalone_mode=False)
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/click/core.py", line 1569, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/click/core.py", line 1490, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/click/core.py", line 1970, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/click/core.py", line 1353, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/click/core.py", line 907, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/omnigent/cli.py", line 6541, in run
    _dispatch_run(
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/omnigent/cli.py", line 6219, in _dispatch_run
    run_chat(
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/omnigent/chat.py", line 441, in run_chat
    _chat_via_daemon(
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/omnigent/chat.py", line 1838, in _chat_via_daemon
    prepared = asyncio.run(
               ^^^^^^^^^^^^
  File "/Users/matthew.moorcroft/.local/share/uv/python/cpython-3.12.13-macos-aarch64-none/lib/python3.12/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Users/matthew.moorcroft/.local/share/uv/python/cpython-3.12.13-macos-aarch64-none/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthew.moorcroft/.local/share/uv/python/cpython-3.12.13-macos-aarch64-none/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/omnigent/chat.py", line 1697, in _prepare_chat_session_via_daemon
    created = await sdk.sessions.create(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/omnigent_client/_sessions.py", line 389, in create
    raise_for_status(resp.status_code, response_body(resp))
  File "/Users/matthew.moorcroft/.local/share/uv/tools/omnigent/lib/python3.12/site-packages/omnigent_client/_errors.py", line 105, in raise_for_status
    raise OmnigentError(message, status_code, code)
omnigent_client._errors.OmnigentError: {'error_code': 403, 'message': 'Invalid access token. [ReqId: 145ae51b-da74-40a7-ac56-0ad190834faf]'}

Steps to reproduce

  1. Configure Omnigent against a Databricks-fronted server (as above) and log in
    once so the pointer record exists.
  2. Let the underlying Databricks OAuth refresh token expire (it lapses after
    a period of inactivity; ~9 days in my case). Confirm with:
    databricks auth describe --host https://[environment]cloud.databricks.com
    
    which reports: Unable to authenticate: A new access token could not be retrieved because the refresh token is invalid.
  3. Launch a bare omnigent (which dispatches to run -> _dispatch_run).
  4. Observed: the launch dies with OmnigentError 403 Invalid access token
    at sessions.create(), and the crash handler auto-files a report.
    Expected: on a TTY, detect the expired credential and run the existing
    browser databricks auth login flow (or at minimum print the exact
    databricks auth login --profile <profile> command) instead of crashing.

Version

0.7.0.dev0

OS

macOS-26.5.2

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingP2-mediumPriority: bug with workaround, important feature requestcomp:serverComponent: server, API, session managementcomp:tuiComponent: terminal UI, REPL, CLItriagedIssue has been triaged by the bot

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions