Skip to content

Rust CLI tool panics on invalid TOML config instead of showing helpful error message #4749

@Shiven0504

Description

@Shiven0504

Description

When the spacetime.toml config file contains invalid TOML syntax, the CLI panics with an unhelpful stack trace instead of providing a user-friendly error message pointing to the syntax error.

Steps to Reproduce

  1. Create a new SpacetimeDB project:
spacetime init my-project --lang rust
   cd my-project
  1. Introduce a syntax error in spacetime.toml:
[module]
   name = "my-project
   # Missing closing quote above
  1. Run any CLI command:
    spacetime build

Expected Behavior

The CLI should catch the TOML parsing error and display:

Error: Invalid TOML syntax in spacetime.toml
  --> spacetime.toml:2:8
   |
 2 | name = "my-project
   |        ^ unterminated string

Help: Check your spacetime.toml for syntax errors

Actual Behavior

The CLI panics with:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { ... }
stack backtrace:
  0: rust_begin_unwind
  ...

Environment

  • SpacetimeDB version: 1.11.3
  • OS: Windows 11 / WSL Ubuntu 22.04
  • Rust: 1.83.0

Additional Context

This affects new users disproportionately. Better error handling for config parsing would significantly improve the DX. Similar pattern exists in tools like cargo which provides excellent TOML error messages.

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