Skip to content

fix(cli): guard .strip() against None values from YAML config#3217

Closed
erosika wants to merge 2 commits intoNousResearch:mainfrom
erosika:eri/fix-nonetype-strip
Closed

fix(cli): guard .strip() against None values from YAML config#3217
erosika wants to merge 2 commits intoNousResearch:mainfrom
erosika:eri/fix-nonetype-strip

Conversation

@erosika
Copy link
Copy Markdown
Contributor

@erosika erosika commented Mar 26, 2026

Summary

  • dict.get("key", "") returns None (not "") when the key exists with a null YAML value
  • Changed to (value or "").strip() in model config resolution and custom provider parsing
  • Prevents 'NoneType' object has no attribute 'strip' crash on startup

Closes #3214

…search#3214)

dict.get("key", "") returns None (not "") when the key exists with a
null YAML value. Use (value or "").strip() to handle this safely in
model config resolution and custom provider parsing.
Same YAML null pattern — _model_config.get("base_url", "") returns
None when the key exists with null value, crashing the `in` operator.
teknium1 pushed a commit that referenced this pull request Mar 28, 2026
dict.get(key, default) only returns default when key is ABSENT.
When YAML has 'key:' with no value, it parses as None — .get()
returns None, then .strip() crashes with AttributeError.

Use (x or '') pattern to handle both missing and null cases.

Co-authored-by: erosika <erosika@users.noreply.github.com>
Salvaged from PR #3217.
teknium1 added a commit that referenced this pull request Mar 28, 2026
dict.get(key, default) only returns default when key is ABSENT.
When YAML has 'key:' with no value, it parses as None — .get()
returns None, then .strip() crashes with AttributeError.

Use (x or '') pattern to handle both missing and null cases.


Salvaged from PR #3217.

Co-authored-by: erosika <erosika@users.noreply.github.com>
@teknium1
Copy link
Copy Markdown
Contributor

Merged via PR #3552. Your fix was cherry-picked onto current main with authorship preserved. Thanks for catching the YAML null → .strip() crash!

@teknium1 teknium1 closed this Mar 28, 2026
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…search#3552)

dict.get(key, default) only returns default when key is ABSENT.
When YAML has 'key:' with no value, it parses as None — .get()
returns None, then .strip() crashes with AttributeError.

Use (x or '') pattern to handle both missing and null cases.


Salvaged from PR NousResearch#3217.

Co-authored-by: erosika <erosika@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): NoneType crash on .strip() when config has null YAML values

2 participants