OptixLog Docs

Troubleshooting

Common problems and fixes for the OptixLog SDK and CLI — authentication, stale bindings, missing config, fixture mode, type errors, and more.

This page covers the most common problems encountered when using the OptixLog SDK and CLI. Each section describes the symptom, the cause, and the fix.


Authentication failures

Symptom: The CLI prints error: ... and exits 1 with a message about an API key or authentication. In Python code, AuthenticationError is raised.

Causes:

  • The API key is missing — neither OPTIXLOG_API_KEY, --api-key, nor a saved credential in ~/.optixlog/credentials.toml was found.
  • The API key is invalid or has been revoked.
  • The key has the wrong format (must start with sk-opt-).
  • The wrong profile is selected (--profile <name> points to an empty or missing profile entry).

Fix: re-authenticate

Run optixlog login to save a fresh credential to ~/.optixlog/credentials.toml. If you are in CI or a non-interactive environment, pass --api-key explicitly or set OPTIXLOG_API_KEY.

optixlog login --api-key sk-opt-yourkey
# or
export OPTIXLOG_API_KEY=sk-opt-yourkey

In Python code, catch AuthenticationError:

from optixlog import AuthenticationError, SDKClient

try:
    client = SDKClient(base_url="https://optixlog.leidos.com", api_key="sk-opt-...")
    mgmt = Management(client)
    # ...
except AuthenticationError as exc:
    print(f"Authentication failed: {exc}")

"no accessible projects for this key"

Symptom: optixlog init exits 1 with error: no accessible projects for this key.

Causes:

  • The API key is a service key scoped to specific projects and those projects have been removed or the key's scope has changed.
  • The key belongs to a different organization than the one you expect.
  • A fixture is being used that has an empty projects array.

Fix: check key scope or switch keys

Run optixlog whoami to confirm which organization and user the current credential belongs to. If you have multiple keys, specify the correct one with --api-key or update the saved credential with optixlog login.

optixlog whoami
optixlog whoami --validate   # re-check against the server

If using a fixture, ensure the projects array in the fixture JSON is non-empty.


Stale generated bindings (generate --check failing)

Symptom: optixlog generate --check exits 1 with:

error: optixlog_gen.py is out of date; re-run `optixlog generate`.

Cause: The schema on the server (or in your fixture) has changed since the last time you ran optixlog generate. The --check flag compares the current output file byte-for-byte against what would be generated now and exits 1 if they differ. This is the expected behavior in CI — it enforces that committed bindings are always in sync with the schema.

Fix: re-run generate

Simply regenerate the bindings and commit the result:

optixlog generate
git add optixlog_gen.py
git commit -m "chore: regenerate optixlog bindings"

In CI, if --check fails, the job is telling you that a schema change has not been reflected in the generated file. Pull the latest schema and regenerate locally before pushing.


"no optixlog.toml found"

Symptom: optixlog generate exits 1 with:

error: no optixlog.toml found; run `optixlog init` first.

Cause: The CLI walks up from the current working directory looking for optixlog.toml and did not find one. Either optixlog init has not been run, or you are running the command from outside your project tree.

Fix: run optixlog init

Navigate to your project root and run optixlog init:

cd /path/to/your/project
optixlog init

init creates optixlog.toml in the current directory. After that, generate can be run from anywhere inside the project tree.

If you want to use a non-standard location, pass --config-path:

optixlog generate --config-path /path/to/optixlog.toml

Fixture / offline issues

Symptom: Commands fail with network errors, or you want to work without a live server connection. You have a fixture JSON file but are unsure how to use it.

Cause: Without --fixture, all CLI commands and SDK calls attempt live network requests to https://optixlog.leidos.com. In environments without network access (local tests, CI without secrets, demo environments), you need to point the CLI at a local fixture.

Fix: use --fixture or OPTIXLOG_FIXTURE

Pass --fixture <path> to any CLI command, or set the OPTIXLOG_FIXTURE environment variable:

# Offline login (saves a credential using the fixture's identity)
optixlog login --fixture tests/fixtures/schema.sample.json \
               --api-key sk-opt-test \
               --base-url http://localhost

# Offline init
optixlog init --fixture tests/fixtures/schema.sample.json --all

# Offline generate
optixlog generate --fixture tests/fixtures/schema.sample.json

Or set once for all commands:

export OPTIXLOG_FIXTURE=tests/fixtures/schema.sample.json
optixlog init --all
optixlog generate

See Offline Fixture Workflow for the full walkthrough and guidance on writing your own fixtures.


Static type-check errors when passing a wrong node type to a project

Symptom: pyright reports reportArgumentType or mypy reports [call-overload] when you pass a node type to project().ingest(). For example:

client.project(Projects.GRATING_COUPLER_LAB).ingest(
    data=LayoutNode(gds_path="x.gds"),  # type error here
    prompt="...",
)

Cause: This is the intended behavior — it is not a bug. The generated OptixClient.project() overloads are typed so that each project's ingest only accepts node types that belong to that project's schema. LayoutNode is defined only in proj_modulator_22b1, not in proj_grating_7f3a. Passing it to the wrong project is a static type error.

This is the type-safety guarantee

The error message from your type checker is telling you that you are trying to ingest a node type into a project whose schema does not include it. Use the correct project:

# LayoutNode belongs to MODULATOR_PROGRAM, not GRATING_COUPLER_LAB
client.project(Projects.MODULATOR_PROGRAM).ingest(
    data=LayoutNode(gds_path="x.gds"),
    prompt="Layout for the modulator.",
)

If you believe the node type should be available in the project, update the schema on the server and re-run optixlog generate to regenerate the bindings.

For a full explanation of how the typing mechanism works, see Type Safety Guarantees and Generated Module Anatomy.


NotFoundError vs get_or_none

Symptom: Your code raises NotFoundError when looking up a workflow node, team, or other resource by id, and you want to handle the "not found" case gracefully rather than catching an exception.

Cause: The get(id) methods on all management collections raise NotFoundError when the resource does not exist. This is by design — it makes missing resources an explicit signal rather than a silent None return.

Fix: use get_or_none for optional lookups

Every collection that has get() also has get_or_none(), which returns None instead of raising:

# Raises NotFoundError if the node does not exist
node = mgmt_project.workflow_nodes.get("node_id_that_may_not_exist")

# Returns None if the node does not exist
node = mgmt_project.workflow_nodes.get_or_none("node_id_that_may_not_exist")
if node is None:
    print("Node not found — skipping.")
    return

Use get() when the resource's absence is an unexpected error condition. Use get_or_none() when absence is a normal case you want to handle in control flow.


Credentials file permissions

Symptom: optixlog login fails with a CredentialsError about file permissions, or Python raises a permission-related OSError when loading credentials.

Cause: ~/.optixlog/credentials.toml must be readable and writable only by the owning user (mode 0600) and ~/.optixlog/ must have mode 0700. If the file was created with looser permissions (e.g. by a script running as root, or after a umask change), the SDK will refuse to load it.

Fix: correct the file permissions

chmod 0700 ~/.optixlog
chmod 0600 ~/.optixlog/credentials.toml

If the directory or file is owned by a different user (e.g. root), change ownership first:

sudo chown -R "$USER" ~/.optixlog
chmod 0700 ~/.optixlog
chmod 0600 ~/.optixlog/credentials.toml

You can verify the result with:

ls -la ~/.optixlog/

Override the credentials directory

If you cannot use ~/.optixlog, point the SDK at a different directory with OPTIXLOG_CONFIG_HOME:

export OPTIXLOG_CONFIG_HOME=/path/to/secure/dir
optixlog login

The SDK creates the directory (with mode 0700) if it does not exist.

On this page