datawhalechina/hello-agents · error · Exception
When using the 'apply' tool with theorem '{theorem_name}', t
Error message
When using the 'apply' tool with theorem '{theorem_name}', theorem parameters must be added. What it means
Raised in the no-parameter branch of apply() when the theorem name is listed in the special_theorem set but the caller did not supply parameters. Special theorems cannot be auto-instantiated by running their GPL premises (their semantics need explicit binding), so apply() refuses to run them without explicit parameters and raises immediately.
Source
Thrown at Co-creation-projects/BitSecret-GPSAgent/src/gps/symbolic_solver.py:1325
premise_ids.update(constraints_premise_ids)
# add operation
operation_id = self._add_operation(('Apply', theorem_name, theorem_paras))
# add conclusions
fact_id, goal_ids = self._add_conclusion(theorem_gdl, replace, premise_ids, operation_id)
if fact_id is None:
return f"定理'{theorem}'所有前提已满足,但添加结论失败。结论可能已经存在,或者结论未通过合法性检查。"
self._check_goals(goal_ids)
result = f"定理'{theorem}'执行成功,以下为问题的状态更新。\n"
return result + self._get_update(old_fact_id, old_goal_id, old_goal_status)
else:
if theorem_name in special_theorem:
msg = f"When using the 'apply' tool with theorem '{theorem_name}', theorem parameters must be added."
raise Exception(msg)
if ('perimeter' in theorem_name or 'area' in theorem_name or
'similar' in theorem_name or 'congruent' in theorem_name):
msg = ("When the theorem name contains 'perimeter', 'area', 'similar' and 'congruent', "
"theorem parameters must be added.")
raise Exception(msg)
all_goal_ids = set()
theorem_gdl = self.parsed_gdl['Theorems'][theorem_name]
paras, instances, premise_ids = self._run_gpl(theorem_gdl['premises_gpl'])
for i in range(len(instances)):
replace = dict(zip(paras, instances[i]))
# add operation
theorem_paras = replace_paras(theorem_gdl['paras'], replace)
operation_id = self._add_operation(('Apply', theorem_name, theorem_paras))
# add conclusionsView on GitHub (pinned to 606a07d341)
Solutions
- Supply explicit parameters: apply('special_theorem_name(A,B,C)') with correct uppercase letters and arity.
- Check membership in special_theorem before calling and choose a different theorem or add parameters.
- Update agent prompts/tool docs so the model knows these theorems are never callable bare.
Example fix
# before
solver.apply('midline') # special theorem, no params
# after
solver.apply('midline(A,B,C)') Defensive patterns
Strategy: validation
Validate before calling
from gps.symbolic_solver import special_theorem # module-level set
def needs_params_bare_forbidden(theorem_name):
return theorem_name in special_theorem
# before calling: if needs_params_bare(...): require '(A,B,...)' in the string Try / catch
try:
solver.apply(theorem)
except Exception as e:
if 'special' in str(e) or "parameters must be added" in str(e):
theorem = f"{theorem.split('(')[0]}({','.join(next_points)})" # retry with params Prevention
- Keep special_theorem membership visible to the prompting layer so bare calls are never attempted.
- Default to including parameters for every apply() call — it is always accepted.
- Unit-test agent-generated theorem strings against (name known, params valid, arity matches, special => has params).
When it happens
Trigger: Calling solver.apply('some_special_theorem') with no parenthesized parameter list where 'some_special_theorem' is in the special_theorem collection defined by the solver module.
Common situations: Agents trying the 'enumerate all instances' shortcut (calling apply with a bare theorem name) on a theorem that requires explicit binding; a theorem newly added to special_theorem while tool prompts still suggest bare invocation.
Related errors
- Unknown theorem name: '{theorem_name}'.
- Theorem parameters must be uppercase letters and , only. The
- '{theorem}' has wrong number of parameters (expected {len(se
- When the theorem name contains 'perimeter', 'area', 'similar
- Unknown relation type '{relation}'.
AI-assisted analysis of datawhalechina/hello-agents@606a07d341 (2026-08-14).
Data as JSON: /api/errors/f496a3bdd0d56222.
Report an issue: GitHub.