{"record":{"id":"3bc14f8039292dc2","repo":"jax-ml/jax","slug":"unsatisfiable-explicit-constraint-constr-debug-s","errorCode":null,"errorMessage":"Unsatisfiable explicit constraint: {constr.debug_str}","messagePattern":"Unsatisfiable explicit constraint: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/export/shape_poly.py","lineNumber":1071,"sourceCode":"      if cmp_pos < 0:\n        raise ValueError(\"Constraint parsing error: must contain one of '==' or '>=' or '<='\")\n    e1_str = c_str[:cmp_pos]\n    e1, = _Parser(e1_str, None, repr(e1_str), self).parse()\n    e2_str = c_str[cmp_pos + 2:]\n    e2, = _Parser(e2_str, None, repr(e2_str), self).parse()\n    if cmp == Comparator.GEQ and not is_geq:\n      e1, e2 = e2, e1\n\n    # Compute e1 - e2 before we add to normalization rules\n    constr = _SymbolicConstraint(debug_str=c_str, cmp=cmp, e1=e1, e2=e2,\n                                 diff=e1 - e2)\n    self._process_explicit_constraint(constr)\n\n  def _process_explicit_constraint(self, constr: _SymbolicConstraint):\n    if (diff_const := _DimExpr._to_constant(constr.diff)) is not None:\n      if ((constr.cmp == Comparator.EQ and diff_const != 0) or\n          (constr.cmp == Comparator.GEQ and diff_const < 0)):\n        raise ValueError(f\"Unsatisfiable explicit constraint: {constr.debug_str}\")\n      return\n\n    if constr.cmp == Comparator.EQ:\n      if not isinstance(constr.e1, _DimExpr):\n        raise ValueError(\"Invalid equality constraint: {e1} == {e2}. \"\n                         \"The left-hand-side must be of the form `term * coefficient`.\")\n      (before, before_k), *rest = constr.e1._sorted_terms\n      if rest:\n        raise ValueError(\"Invalid equality constraint: {e1} == {e2}. \"\n                         \"The left-hand-side must be of the form `term * coefficient`.\")\n\n      after = _ensure_poly(constr.e2, \"parse_constraint\", constr.e1.scope)\n      if before in self._normalization_rules:\n        raise NotImplementedError(\n            f\"Found multiple equality constraints with the same left-hand-side: {before}\")\n      self._normalization_rules[before] = (after, before_k)\n      # Look for constraints of the form mod(before_e1, before_k2) * 1 == 0\n      if (before_k == 1 and","sourceCodeStart":1053,"sourceCodeEnd":1089,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/export/shape_poly.py#L1053-L1089","documentation":"After parsing, JAX evaluates the constant difference e1-e2 of a constraint. If both sides are known constants and the constraint is false (e.g. '3 == 4' or '2 >= 5'), it is unsatisfiable and rejected immediately.","triggerScenarios":"Constraints between constants that contradict: '4 <= 3', '8 == 9', or expressions that constant-fold to a violated comparison, e.g. '2*2 >= 5'.","commonSituations":"Computed constraint strings where a variable was substituted by a wrong constant; inverted comparison direction by mistake.","solutions":["Fix the arithmetic or comparator direction so the constant constraint holds","If the operands were meant to be symbolic, check variable spelling (a typo makes both sides constant)","Print/inspect the generated constraint strings before constructing the SymbolicScope"],"exampleFix":"# before\nconstraints = ('2 * 2 >= 5',)\n# after\nconstraints = ('2 * 2 <= 5',)  # or fix the intended math","handlingStrategy":"validation","validationCode":"# both sides constant and comparison false -> reject early\nfor c in constraints:\n    if well_formed(c) and both_constant(c): assert eval_const_cmp(c)","typeGuard":null,"tryCatchPattern":"try:\n    scope = SymbolicScope(constraints)\nexcept ValueError as e:\n    if 'Unsatisfiable' in str(e): fix_constraint_arithmetic()","preventionTips":["Double-check comparator direction when writing bounds","Log generated constraint strings before constructing scopes"],"tags":["jax","shape-polymorphism","constraints","unsatisfiable"],"backgroundTag":"unsatisfiable-constraint","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}