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
- Install the STT plugin and run
/elevenlabs-stt:setup
- Set an API key via
config.api_key = '...' and call config.save()
save() returns False — the config file is not written
- 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
Bug Description
The
config.save()method in the STT plugin always fails silently (returnsFalse) wheninput_deviceisNone(the default value). This is becausetomli_wcannot serialize PythonNonevalues — TOML has no null type — and the resultingTypeErroris caught by a bareexcept Exception: return False.This means no configuration changes can be saved after a fresh install until
input_deviceis explicitly set to a non-None value.Steps to Reproduce
/elevenlabs-stt:setupconfig.api_key = '...'and callconfig.save()save()returnsFalse— the config file is not writtenConfig.load(), the API key is lostRoot Cause
In
stt/src/elevenlabs_stt/config.py, thesave()method (line 154-169) includes all fields in the TOML dict:input_devicedefaults toNone(line 49):When
tomli_w.dump()encountersNone, it raises:This exception is silently caught on line 183:
Suggested Fix
Filter out
Nonevalues before serialization:Or alternatively, convert
Noneto a sentinel/empty string before dumping.Environment