Skip to content
This repository was archived by the owner on Aug 4, 2026. It is now read-only.
This repository was archived by the owner on Aug 4, 2026. It is now read-only.

STT config.save() silently fails due to None value in TOML serialization #3

Description

@Kyotani-Hub

Bug Description

The config.save() method in the STT plugin always fails silently (returns False) when input_device is None (the default value). This is because tomli_w cannot serialize Python None values — TOML has no null type — and the resulting TypeError is caught by a bare except Exception: return False.

This means no configuration changes can be saved after a fresh install until input_device is explicitly set to a non-None value.

Steps to Reproduce

  1. Install the STT plugin and run /elevenlabs-stt:setup
  2. Set an API key via config.api_key = '...' and call config.save()
  3. save() returns False — the config file is not written
  4. On next Config.load(), the API key is lost

Root Cause

In stt/src/elevenlabs_stt/config.py, the save() method (line 154-169) includes all fields in the TOML dict:

data = {
    "elevenlabs-stt": {
        ...
        "input_device": self.input_device,  # This is None by default
        ...
    }
}

input_device defaults to None (line 49):

input_device: Optional[str] = Field(default=None, ...)

When tomli_w.dump() encounters None, it raises:

TypeError: Object of type 'NoneType' is not TOML serializable

This exception is silently caught on line 183:

except Exception:
    return False

Suggested Fix

Filter out None values before serialization:

data = {
    "elevenlabs-stt": {k: v for k, v in {
        "api_key": self.api_key,
        "model_id": self.model_id,
        # ... other fields ...
        "input_device": self.input_device,
        # ... other fields ...
    }.items() if v is not None}
}

Or alternatively, convert None to a sentinel/empty string before dumping.

Environment

  • Claude Code v2.1.92
  • Windows 11
  • Python 3.11.9 (via uv)
  • tomli_w 1.2.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions