{"record":{"id":"a8199eda0af41b73","repo":"langgenius/dify","slug":"the-job-does-not-exist-a8199e","errorCode":null,"errorMessage":"The job does not exist.","messagePattern":"The job does not exist\\.","errorType":"http","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"api/controllers/console/datasets/datasets_segments.py","lineNumber":678,"sourceCode":"                job_id,\n                upload_file_id,\n                dataset_id_str,\n                document_id_str,\n                current_tenant_id,\n                current_user.id,\n            )\n        except Exception as e:\n            return {\"error\": str(e)}, 500\n        return dump_response(SegmentBatchImportStatusResponse, {\"job_id\": job_id, \"job_status\": \"waiting\"}), 200\n\n    @console_ns.response(200, \"Batch import status\", console_ns.models[SegmentBatchImportStatusResponse.__name__])\n    @setup_required\n    @login_required\n    @account_initialization_required\n    @rbac_permission_required(RBACResourceScope.DATASET, RBACPermission.DATASET_READONLY)\n    def get(self, job_id=None, dataset_id: UUID | None = None, document_id: UUID | None = None):\n        if job_id is None:\n            raise NotFound(\"The job does not exist.\")\n        job_id = str(job_id)\n        indexing_cache_key = f\"segment_batch_import_{job_id}\"\n        cache_result = redis_client.get(indexing_cache_key)\n        if cache_result is None:\n            raise ValueError(\"The job does not exist.\")\n\n        response = {\"job_id\": job_id, \"job_status\": cache_result.decode()}\n        return dump_response(SegmentBatchImportStatusResponse, response), 200\n\n\n@console_ns.route(\"/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/segments/<uuid:segment_id>/child_chunks\")\nclass ChildChunkAddApi(Resource):\n    @console_ns.doc(params=SegmentDocParams.DATASET_DOCUMENT_PARENT_SEGMENT)\n    @setup_required\n    @login_required\n    @account_initialization_required\n    @cloud_edition_billing_resource_check(\"vector_space\")\n    @cloud_edition_billing_knowledge_limit_check(\"add_segment\")","sourceCodeStart":660,"sourceCodeEnd":696,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/datasets/datasets_segments.py#L660-L696","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Always call GET /console/api/datasets/batch_import_status/{job_id} with the job_id returned by the POST that started the import.","Check gateway/proxy rewrite rules to ensure the trailing <uuid:job_id> segment is preserved.","In client code, validate that the stored job_id is non-empty before issuing the status request."],"exampleFix":"// before\nGET /console/api/datasets/batch_import_status/\n// after\nGET /console/api/datasets/batch_import_status/{job_id}","handlingStrategy":"validation","validationCode":"function requireJobId(jobId) {\n  if (!jobId) throw new Error('job_id is required; pass the id returned by the POST that started the import');\n  return jobId;\n}","typeGuard":"const hasJobId = (jobId) => typeof jobId === 'string' && jobId.length > 0 && jobId !== 'null';","tryCatchPattern":"const url = `/console/api/datasets/batch_import_status/${encodeURIComponent(requireJobId(jobId))}`;\nreturn fetch(url);","preventionTips":["Always build the status URL from the job_id returned by the POST.","Check reverse-proxy rewrite rules to confirm the trailing path segment survives.","Do not call the status endpoint with an empty or placeholder id."],"tags":["datasets","batch-import","job-status","not-found","rest-api"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}