{"record":{"id":"77ae085910cfe546","repo":"jax-ml/jax","slug":"method-method-not-recognized","errorCode":null,"errorMessage":"Method {method} not recognized","messagePattern":"Method (.+?) not recognized","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/scipy/optimize/minimize.py","lineNumber":133,"sourceCode":"                           hess_inv=results.H_k,\n                           nfev=results.nfev,\n                           njev=results.ngev,\n                           nit=results.k)\n\n  if method.lower() == 'l-bfgs-experimental-do-not-rely-on-this':\n    results = _minimize_lbfgs(fun_with_args, x0, **options)\n    success = results.converged & jnp.logical_not(results.failed)\n    return OptimizeResults(x=results.x_k,\n                           success=success,\n                           status=results.status,\n                           fun=results.f_k,\n                           jac=results.g_k,\n                           hess_inv=None,\n                           nfev=results.nfev,\n                           njev=results.ngev,\n                           nit=results.k)\n\n  raise ValueError(f\"Method {method} not recognized\")\n","sourceCodeStart":115,"sourceCodeEnd":134,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/scipy/optimize/minimize.py#L115-L134","documentation":"jax.scipy.optimize.minimize only ships a small set of methods (BFGS and L-BFGS and a few others handled above the raise); any unrecognized method string falls through to this ValueError.","triggerScenarios":"Passing method='Nelder-Mead', method='CG', method='Powell', or a typo like 'lbfgs ' (note: match is on exact strings per-branch, commonly lowercase).","commonSituations":"Porting scipy.optimize scripts expecting the full scipy method menu; jax supports only a subset.","solutions":["Use a supported method such as 'BFGS' or 'L-BFGS'","If you need other algorithms, use jaxopt/optax optimizers instead","Check the method string spelling/case against the dispatch branches"],"exampleFix":"# before\nres = minimize(loss, x0, method='Nelder-Mead')\n# after\nimport optax\n# or\nres = minimize(loss, x0, method='BFGS')","handlingStrategy":"validation","validationCode":"assert method.lower() in ('bfgs', 'l-bfgs', 'l-bfgs-experimental-do-not-rely-on-this'), method","typeGuard":"def method_supported(m: str) -> bool: return m.lower() in ('bfgs', 'l-bfgs')","tryCatchPattern":null,"preventionTips":["Check the dispatch list in your jax version's minimize source"],"tags":["jax","scipy","optimize","argument-validation"],"backgroundTag":"invalid-enum-argument","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}