Skip to content

fix: store channel list config values as strings to prevent deseriali…#366

Closed
modship wants to merge 1 commit intoRightNow-AI:mainfrom
modship:claude/compassionate-chebyshev
Closed

fix: store channel list config values as strings to prevent deseriali…#366
modship wants to merge 1 commit intoRightNow-AI:mainfrom
modship:claude/compassionate-chebyshev

Conversation

@modship
Copy link

@modship modship commented Mar 6, 2026

Discord guild IDs (and other numeric IDs) were parsed as TOML integers by upsert_channel_config(), but the config structs expect Vec. This caused "invalid type: integer, expected a string" errors when loading config.

  • Always serialize FieldType::List items as TOML strings
  • Align TelegramConfig::allowed_users from Vec to Vec for consistency
  • Add deserialize_string_or_int_vec helper on all 22 channel Vec fields for backwards compatibility with existing config files containing integers

Summary

When I configure Discord through the web interface, everything seems fine, but the backend reports an error.

2026-03-06T09:49:01.868039Z WARN openfang_kernel::config: Failed to deserialize merged config, using defaults error=invalid type: integer 1171XXXXXXXXXXXXX718, expected a string in channels.discord.allowed_guilds path=/data/config.toml

Changes

Testing

  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes
  • Live integration tested (if applicable)

Security

  • No new unsafe code
  • No secrets or API keys in diff
  • User input validated at boundaries

…zation failures

Discord guild IDs (and other numeric IDs) were parsed as TOML integers by
upsert_channel_config(), but the config structs expect Vec<String>. This caused
"invalid type: integer, expected a string" errors when loading config.

- Always serialize FieldType::List items as TOML strings
- Align TelegramConfig::allowed_users from Vec<i64> to Vec<String> for consistency
- Add deserialize_string_or_int_vec helper on all 22 channel Vec<String> fields
  for backwards compatibility with existing config files containing integers
@modship modship marked this pull request as ready for review March 6, 2026 16:25
@jaberjaber23
Copy link
Member

Implemented in v0.3.25. Channel config deserialization fixed with deserialize_string_or_int_vec helper applied to all Vec ID fields across 20 channel configs.

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.

2 participants