Skip to content

gulliver.toml: a section with the wrong type (budget = 3, lint = 5, [connections] x = 1) crashes with a Python traceback #126

Closed

Description

@laaielichter

A typo in a section name already gets a clear message (Unknown section(s) in gulliver.toml: budjet, see #77). A section that has the right name but the wrong shape does not. Writing a plain value where a table belongs ends in a Python traceback on every command:

printf 'budget = 3\n' > t.toml
gulliver --config t.toml status
# Traceback (most recent call last):
#   ...
#   File "src/gulliver/config.py", line 275, in load_settings
#     budget_data = dict(data.get("budget") or {})
# TypeError: 'int' object is not iterable

printf 'connections = "x"\n' > t.toml
gulliver --config t.toml status
# AttributeError: 'str' object has no attribute 'items'

printf '[connections]\nx = 1\n' > t.toml
gulliver --config t.toml status
# TypeError: 'int' object is not iterable          (config.py line 254, dict(conn_data))

printf 'lint = 5\n' > t.toml
gulliver --config t.toml lint "SELECT 1"
# TypeError: 'int' object is not iterable          (lint_files.py line 150)

printf 'review = 3\n' > t.toml
gulliver --config t.toml review --models models
# TypeError: 'int' object is not iterable          (review.py line 106, load_policy)

printf 'approval = "cli"\n' > t.toml
gulliver --config t.toml status
# "error": "Unknown approval keys: c, i, l"        (a string is read as a table of characters)

All other config mistakes in gulliver.toml (unknown keys, a bad fail_on, a bad [approval] channel) are reported as status: "error" with next_step: "Fix gulliver.toml or the flags." and exit code 1. These should be too: someone who writes budget = 3 meant a limit, and a traceback does not tell them where to look.

Checked on current main (c48adf8).

What should happen

Each of these returns status: "error" (exit code 1) with a message that names the section and the type that is expected, for example [budget] must be a table (a [budget] section with keys), not 3 and next_step: "Fix gulliver.toml or the flags.". Valid files behave exactly as before.

Where to start

  • src/gulliver/config.py: load_settings(...) (around line 239). data.get("connections"), data.get("budget") and data.get("approval") are used without a type check (lines 253, 254, 275, 285); ConfigError is the error type the CLI already turns into a clean message. A tiny helper such as _table(data, "budget") that raises ConfigError when the value is not a dict would cover all of them, and [connections.NAME] entries need the same check
  • src/gulliver/lint_files.py (load_lint_config, around line 150) and src/gulliver/review.py (load_policy, around line 106) read [lint] and [review] the same way
  • Tests: tests/test_config.py (test_unknown_top_level_section_is_refused and test_every_known_section_loads show how to write a gulliver.toml in tmp_path and call load_settings)

How to test

printf 'budget = 3\n' > t.toml && gulliver --config t.toml status      # now: an error, exit code 1, no traceback
printf 'lint = 5\n' > t.toml && gulliver --config t.toml lint "SELECT 1"
pytest tests/test_config.py

Done when

  • budget, connections, a [connections.NAME] entry, approval, lint and review with a value that is not a table give a ConfigError-style message naming the section (exit code 1, no traceback)
  • A valid gulliver.toml (every example in gulliver.example.toml) loads exactly as before
  • A parametrized test with one wrong-type file per section
  • Leave CHANGELOG.md alone; the maintainer adds the entry with credit to you when it is merged
  • pytest and ruff check . pass

Comment here to claim it and you'll be assigned.

Activity

  1. amritkang165 commented on Nov 11, 2026

    @amritkang165
    Contributor

    I’d like to take this one. I’ll add type checks for the affected config sections, keep valid configs working as before, and test that invalid values produce clear errors without tracebacks.

  2. laaielichter commented on Nov 11, 2026

    @laaielichter
    OwnerAuthor

    Thanks @amritkang165, you asked for #126 at 13:32 on 2026-11-11 and that is the first claim on this thread, so it is assigned to you. Your plan matches the issue, and I see PR #144 is already open for it, so I will review it next. Thank you for taking on a third issue in a row after #129 and #128.


    Generated by Claude Code

  3. added a commit that references this issue on Nov 16, 2026
  4. added 2 commits that reference this issue on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions