langgenius/dify · warning · ValueError

The job does not exist.

Error message

The job does not exist.

What it means

A ValueError raised in AnnotationReplyActionStatusApi.get: redis_client.get(f'{action}_app_annotation_job_{job_id}') returned None, so the job status is unknown to the API. Annotation reply jobs are tracked as Redis keys (not DB rows), so a missing key means the job never had its status written, already expired, or the action/job_id pair is wrong. It surfaces as a 500 because ValueError is not translated to 404 at this endpoint.

Source

Thrown at api/controllers/console/app/annotation.py:272

    @console_ns.doc("get_annotation_reply_action_status")
    @console_ns.doc(description="Get status of annotation reply action job")
    @console_ns.doc(params={"app_id": "Application ID", "job_id": "Job ID", "action": "Action type"})
    @console_ns.response(
        200, "Job status retrieved successfully", console_ns.models[AnnotationJobStatusDetailResponse.__name__]
    )
    @console_ns.response(403, "Insufficient permissions")
    @setup_required
    @login_required
    @account_initialization_required
    @cloud_edition_billing_resource_check("annotation")
    @edit_permission_required
    @rbac_permission_required(RBACResourceScope.APP, RBACPermission.APP_VIEW_LAYOUT)
    def get(self, app_id: UUID, job_id: UUID, action: str):
        job_id_str = str(job_id)
        app_annotation_job_key = f"{action}_app_annotation_job_{job_id_str}"
        cache_result = redis_client.get(app_annotation_job_key)
        if cache_result is None:
            raise ValueError("The job does not exist.")

        job_status = cache_result.decode()
        error_msg = ""
        if job_status == "error":
            app_annotation_error_key = f"{action}_app_annotation_error_{job_id_str}"
            error_msg = redis_client.get(app_annotation_error_key).decode()

        return AnnotationJobStatusDetailResponse(
            job_id=job_id_str, job_status=job_status, error_msg=error_msg
        ).model_dump(mode="json"), 200


@console_ns.route("/apps/<uuid:app_id>/annotations")
class AnnotationApi(Resource):
    @console_ns.doc("list_annotations")
    @console_ns.doc(description="Get annotations for an app with pagination")
    @console_ns.doc(params={"app_id": "Application ID"})
    @console_ns.doc(params=query_params_from_model(AnnotationListQuery))

View on GitHub (pinned to ef8544b173)

Solutions

  1. Re-trigger the annotation-reply action to produce a fresh job_id, then poll that id with the same action value.
  2. Confirm the action token in the URL matches the action used when the job was created.
  3. Check Redis TTL/eviction policy if keys expire before polling completes; raise maxmemory/retention if needed.
  4. Verify the job-creation call actually succeeded (no exception) so a status key was written before you started polling.
Defensive patterns

Strategy: try-catch

Validate before calling

def job_status_exists(redis_client, action: str, job_id: str) -> bool:
    return redis_client.get(f'{action}_app_annotation_job_{job_id}') is not None

Try / catch

try:
    status = client.get(status_url)
except ValueError as exc:
    if 'job does not exist' in str(exc).lower():
        # key missing/expired: re-trigger the action and poll the new job_id
        new_job = trigger_annotation_action()
        status = client.get(status_url_for(new_job))
    raise

Prevention

When it happens

Trigger: GET /console/apps/<app_id>/annotation-reply/<action>/status/<job_id> where the Redis key for that (action, job_id) does not exist. Reproducible by polling a job_id that was never created, that already completed and its TTL expired, or by passing an action value other than the one used when the job was enqueued.

Common situations: Polling a stale job_id after Redis eviction or TTL expiry; wrong action token (e.g. 'import' vs 'export') combined with a real job_id; Redis flushed/restarted between job creation and status poll; job-creation step failed so no key was ever written.

Related errors


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/7313974df827a83c. Report an issue: GitHub.