{"record":{"id":"d197a9ba7e5706f1","repo":"mlflow/mlflow","slug":"e-message-from-submit-job-failure","errorCode":null,"errorMessage":"e.message (from submit_job failure)","messagePattern":"e\\.message \\(from submit_job failure\\)","errorType":"http","errorClass":"HTTPException","httpStatus":null,"severity":"error","filePath":"mlflow/server/job_api.py","lineNumber":85,"sourceCode":"    timeout: float | None = None\n\n\n@job_api_router.post(\"/\", response_model=Job)\ndef submit_job(payload: SubmitJobPayload, request: Request) -> Job:\n    from mlflow.server.jobs import submit_job\n    from mlflow.server.jobs.utils import _load_function, get_job_fn_fullname\n\n    job_name = payload.job_name\n    # Record the caller (stamped on request.state by the middleware; flask.g isn't populated\n    # there) as the job creator, so ownership checks on get/cancel recognize the submitter.\n    creator = getattr(request.state, \"username\", None)\n    try:\n        function_fullname = get_job_fn_fullname(job_name)\n        function = _load_function(function_fullname)\n        job = submit_job(function, payload.params, payload.timeout, creator=creator)\n        return Job.from_job_entity(job)\n    except MlflowException as e:\n        raise HTTPException(\n            status_code=e.get_http_status_code(),\n            detail=e.message,\n        )\n\n\n@job_api_router.patch(\"/cancel/{job_id}\", response_model=Job)\ndef cancel_job(job_id: str) -> Job:\n    from mlflow.server.jobs import cancel_job\n\n    try:\n        job = cancel_job(job_id)\n        return Job.from_job_entity(job)\n    except MlflowException as e:\n        raise HTTPException(\n            status_code=e.get_http_status_code(),\n            detail=e.message,\n        )\n","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/server/job_api.py#L67-L103","documentation":"The REST job API's submit_job endpoint converts MlflowExceptions from job function resolution or submission (e.g. unknown job_name, invalid params, submission failure) into a FastAPI HTTPException carrying the original message and mapped HTTP status.","triggerScenarios":"POST /job/submit (used by evaluation, scorer, and prompt-optimization handlers) where get_job_fn_fullname, _load_function, or submit_job raises MlflowException — e.g. unregistered job_name or invalid params.","commonSituations":"Submitting a job whose name is not registered on the server; invalid params payload failing job-side validation; plugin/job module failing to import on the server.","solutions":["Check the HTTPException detail for the underlying cause and correct job_name/params accordingly.","Ensure the job function module is installed/importable on the server process.","Catch the HTTPException client-side and surface detail to the user."],"exampleFix":"// before\njob = submit_endpoint(job_name=\"unknown_job\", params={})\n// after\ntry:\n    job = submit_endpoint(job_name=\"mlflow.genai...\", params={\"experiment_id\": \"1\"})\nexcept httpx.HTTPStatusError as e:\n    print(e.response.json()[\"detail\"])","handlingStrategy":"try-catch","validationCode":"# client-side preflight\nassert job_name in known_registered_jobs\nassert all(k in params for k in required_params[job_name])","typeGuard":null,"tryCatchPattern":"try:\n    job = submit_via_api(job_name, params)\nexcept httpx.HTTPStatusError as e:\n    detail = e.response.json().get(\"detail\")\n    ...  # log detail, which is the underlying MlflowException message\n    raise","preventionTips":["Use only job names registered in the server's job registry.","Validate params against the job function's expected schema before submitting.","Ensure job function modules are installed on the server."],"tags":["mlflow","fastapi","http-exception","jobs"],"backgroundTag":"job-submission-failed","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}