langgenius/dify · error · NotFound

The job does not exist.

Error message

The job does not exist.

What it means

Raised by the GET batch-import-status handler when the route matched but job_id was not supplied (None). In practice the Flask route '/datasets/batch_import_status/<uuid:job_id>' always provides a value, so this is a defensive guard. A hit here usually means an internal dispatch or reverse-proxy rewrite dropped the path parameter.

Source

Thrown at api/controllers/console/datasets/datasets_segments.py:678

                job_id,
                upload_file_id,
                dataset_id_str,
                document_id_str,
                current_tenant_id,
                current_user.id,
            )
        except Exception as e:
            return {"error": str(e)}, 500
        return dump_response(SegmentBatchImportStatusResponse, {"job_id": job_id, "job_status": "waiting"}), 200

    @console_ns.response(200, "Batch import status", console_ns.models[SegmentBatchImportStatusResponse.__name__])
    @setup_required
    @login_required
    @account_initialization_required
    @rbac_permission_required(RBACResourceScope.DATASET, RBACPermission.DATASET_READONLY)
    def get(self, job_id=None, dataset_id: UUID | None = None, document_id: UUID | None = None):
        if job_id is None:
            raise NotFound("The job does not exist.")
        job_id = str(job_id)
        indexing_cache_key = f"segment_batch_import_{job_id}"
        cache_result = redis_client.get(indexing_cache_key)
        if cache_result is None:
            raise ValueError("The job does not exist.")

        response = {"job_id": job_id, "job_status": cache_result.decode()}
        return dump_response(SegmentBatchImportStatusResponse, response), 200


@console_ns.route("/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/segments/<uuid:segment_id>/child_chunks")
class ChildChunkAddApi(Resource):
    @console_ns.doc(params=SegmentDocParams.DATASET_DOCUMENT_PARENT_SEGMENT)
    @setup_required
    @login_required
    @account_initialization_required
    @cloud_edition_billing_resource_check("vector_space")
    @cloud_edition_billing_knowledge_limit_check("add_segment")

View on GitHub (pinned to ef8544b173)

Solutions

  1. Always call GET /console/api/datasets/batch_import_status/{job_id} with the job_id returned by the POST that started the import.
  2. Check gateway/proxy rewrite rules to ensure the trailing <uuid:job_id> segment is preserved.
  3. In client code, validate that the stored job_id is non-empty before issuing the status request.

Example fix

// before
GET /console/api/datasets/batch_import_status/
// after
GET /console/api/datasets/batch_import_status/{job_id}
Defensive patterns

Strategy: validation

Validate before calling

function requireJobId(jobId) {
  if (!jobId) throw new Error('job_id is required; pass the id returned by the POST that started the import');
  return jobId;
}

Type guard

const hasJobId = (jobId) => typeof jobId === 'string' && jobId.length > 0 && jobId !== 'null';

Try / catch

const url = `/console/api/datasets/batch_import_status/${encodeURIComponent(requireJobId(jobId))}`;
return fetch(url);

Prevention

When it happens

Trigger: GET /console/api/datasets/batch_import_status/ (no job_id segment) or an internal call that invokes the view function with job_id=None. Also possible if a misconfigured route prefix strips the trailing path parameter.

Common situations: Reverse proxy or API gateway rewrite rule that drops the trailing path segment; test harness invoking the handler directly without a job_id; malformed client URL that the router still accepts.

Related errors


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