{"record":{"id":"ed4034983ec22239","repo":"invoke-ai/InvokeAI","slug":"the-download-service-is-not-currently-accepting-re","errorCode":null,"errorMessage":"The download service is not currently accepting requests. Please call start() to initialize the service.","messagePattern":"The download service is not currently accepting requests\\. Please call start\\(\\) to initialize the service\\.","errorType":"exception","errorClass":"ServiceInactiveException","httpStatus":null,"severity":"error","filePath":"invokeai/app/services/download/download_default.py","lineNumber":139,"sourceCode":"                self._queue.queue.clear()\n            self.cancel_all_jobs()\n            self._stop_event.set()\n            for thread in self._worker_pool:\n                thread.join()\n            self._worker_pool.clear()\n\n    def submit_download_job(\n        self,\n        job: DownloadJob,\n        on_start: Optional[DownloadEventHandler] = None,\n        on_progress: Optional[DownloadEventHandler] = None,\n        on_complete: Optional[DownloadEventHandler] = None,\n        on_cancelled: Optional[DownloadEventHandler] = None,\n        on_error: Optional[DownloadExceptionHandler] = None,\n    ) -> None:\n        \"\"\"Enqueue a download job.\"\"\"\n        if not self._accept_download_requests:\n            raise ServiceInactiveException(\n                \"The download service is not currently accepting requests. Please call start() to initialize the service.\"\n            )\n        if job.id == -1:\n            job.id = self._next_id()\n        job.set_callbacks(\n            on_start=on_start,\n            on_progress=on_progress,\n            on_complete=on_complete,\n            on_cancelled=on_cancelled,\n            on_error=on_error,\n        )\n        self._jobs[job.id] = job\n        self._queue.put(job)\n\n    def pause_job(self, job: DownloadJobBase) -> None:\n        \"\"\"Pause the indicated job, preserving partial downloads.\"\"\"\n        if job.status in [DownloadJobStatus.WAITING, DownloadJobStatus.RUNNING]:\n            job.pause()","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/services/download/download_default.py#L121-L157","documentation":"submit_download_job() raises ServiceInactiveException when the service flag _accept_download_requests is false, i.e. the service was never started, is stopping, or was stopped. Queueing a job into a dead service would silently lose work, so it fails fast.","triggerScenarios":"Calling submit_download_job() before start(), after stop(), or during a stop/start transition where _stop_event was set and requests rejected.","commonSituations":"A download request arrives during app shutdown, a consumer grabs the service before the startup routine ran, or stop() was called by a previous error handler and the service never restarted.","solutions":["Call service.start() before submitting any jobs","Check that startup completed (e.g. await app startup/lifespan) before issuing downloads","If the service was stopped, restart it with start() and resubmit","Review shutdown handlers to ensure stop() only runs at true shutdown"],"exampleFix":"// before\nservice.submit_download_job(job)\n// after\n\nservice.start()\nservice.submit_download_job(job)","handlingStrategy":"try-catch","validationCode":"def service_accepting(s) -> bool:\n    return bool(getattr(s, \"_accept_download_requests\", False))\n# only submit when service_accepting(service) is True","typeGuard":"def is_active(s: object) -> bool:\n    return bool(getattr(s, \"_accept_download_requests\", False))","tryCatchPattern":"try:\n    service.submit_download_job(job)\nexcept ServiceInactiveException:\n    service.start()\n    service.submit_download_job(job)","preventionTips":["Check _accept_download_requests (or a wrapper flag) before submitting","Ensure startup hooks complete before accepting user download requests","Block/queue requests during shutdown rather than submitting","Restart the service after any stop() if further downloads are expected"],"tags":["lifecycle","download","service-inactive"],"backgroundTag":"service-not-started","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}