affaan-m/ECC · error · ValueError
Pass either config or PromptBuilder keyword options, not…
Error message
Pass either config or PromptBuilder keyword options, not both
What it means
PromptBuilder.__init__ enforces mutual exclusivity: you may pass either a PromptConfig object OR individual keyword template options (system_template, user_template, include_tools_in_system, tool_format), never both. Mixing them is ambiguous, so a ValueError is raised.
Solutions
- Remove the keyword options and put all settings into the PromptConfig
- Or drop the config argument and pass only keyword options
- In wrapper code, branch: build config from kwargs when any kwarg is set, else pass config through
Example fix
// before PromptBuilder(config=cfg, system_template='You are...') // after cfg = PromptConfig(system_template='You are...', **base) PromptBuilder(config=cfg)
Defensive patterns
Strategy: validation
Validate before calling
opts = {k: v for k, v in kwargs.items() if v is not None}
if config is not None and opts:
raise ValueError('pass config or kwargs, not both') Try / catch
try:
builder = PromptBuilder(config=cfg, **overrides)
except ValueError as e:
if 'not both' in str(e):
logger.warning('conflicting builder args; preferring kwargs')
builder = PromptBuilder(**overrides) Prevention
- Pick one construction style (config object) project-wide
- In wrappers, merge overrides into config instead of forwarding both
- Add a lint rule or helper factory that hides the raw constructor
When it happens
Trigger: PromptBuilder(config=cfg, system_template='...') or PromptBuilder(config=cfg, tool_format='xml') — any combination of a non-None config with at least one non-None template option.
Common situations: Refactoring from keyword-style construction to config objects and leaving a stray keyword argument; wrapping the builder in a helper that forwards both user config and overrides.
Related errors
- clip has no 'path
- clip ( ) has non-positive duration
- ContextLengthError(msg, provider=ProviderType.CLAUDE) from e
- ContextLengthError(msg, provider=ProviderType.OLLAMA) from e
- empty response
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/7e7e0a927045538a.
Report an issue: GitHub.
Appendix: source
Thrown at src/llm/prompt/builder.py:33
include_tools_in_system: bool = True
tool_format: str = "native"
class PromptBuilder:
def __init__(
self,
config: PromptConfig | None = None,
*,
system_template: str | None = None,
user_template: str | None = None,
include_tools_in_system: bool | None = None,
tool_format: str | None = None,
) -> None:
if config is not None and any(
value is not None
for value in (system_template, user_template, include_tools_in_system, tool_format)
):
raise ValueError("Pass either config or PromptBuilder keyword options, not both")
if config is None:
defaults = PromptConfig()
config = PromptConfig(
system_template=(
system_template if system_template is not None else defaults.system_template
),
user_template=(
user_template if user_template is not None else defaults.user_template
),
include_tools_in_system=(
include_tools_in_system
if include_tools_in_system is not None
else defaults.include_tools_in_system
),
tool_format=(
tool_format if tool_format is not None else defaults.tool_format
),View on GitHub (pinned to 8321021c54)