Skip to content

[Bug] IAC_CODE_PROVIDER rejects documented provider names with spaces #39

@Prodesire

Description

@Prodesire

Bug Description

IAC_CODE_PROVIDER rejects provider names that are shown as valid in its own error message. For example, the error message lists OpenAPI Compatible as a valid value, but setting IAC_CODE_PROVIDER="OpenAPI Compatible" fails validation.

Steps to Reproduce

  1. Use an isolated configuration directory.
  2. Configure an OpenAPI-compatible provider through environment variables:
export IAC_CODE_CONFIG_DIR="$(mktemp -d)"
export IAC_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
export IAC_CODE_PROVIDER="OpenAPI Compatible"
export IAC_CODE_MODEL="fake-model"
export IAC_CODE_API_KEY="test-key"
export IAC_CODE_BASE_URL="http://127.0.0.1:12345/v1"
uv run iac-code --prompt hello

Expected Behavior

IAC_CODE_PROVIDER="OpenAPI Compatible" should be accepted because OpenAPI Compatible is listed as a valid provider name.

Alternatively, the error message should only list the exact accepted spellings.

Actual Behavior

The command exits with code 1 and prints:

Invalid IAC_CODE_PROVIDER value: 'OpenAPI Compatible'. Valid values (case-insensitive): DashScope, DashScope Token Plan, OpenAI, Anthropic, DeepSeek, OpenAPI Compatible, ...

The rejected value is included in the valid values list. IAC_CODE_PROVIDER=OpenAPICompatible works.

Operating System

macOS

Python Version

Python 3.14.2

iac-code Version

0.3.0 (uv run iac-code --version output: iac-code v0.3.0)

LLM Provider

Other

IaC Type

Not applicable

Additional Context

Tested from a local source checkout with uv run iac-code on 2026-05-29. No real LLM or cloud credentials were used.

Likely related code:

  • src/iac_code/config.py: _build_provider_name_to_key() normalizes provider names by removing spaces, hyphens, and underscores.
  • src/iac_code/config.py: _get_env_overrides() looks up provider_raw.lower() directly.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions