{"record":{"id":"2676118d4cdf1120","repo":"langgenius/dify","slug":"cannot-start-the-e2e-agent-backend-because-agent","errorCode":null,"errorMessage":"Cannot start the E2E Agent backend because ${agentBackendHost}:${agentBackendPort} is already in use.${listenerMessage}","messagePattern":"Cannot start the E2E Agent backend because (.+?):(.+?) is already in use\\.(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"e2e/scripts/setup.ts","lineNumber":353,"sourceCode":"      '--no-sync',\n      'flask',\n      'run',\n      '--host',\n      apiBindHost,\n      '--port',\n      String(apiPort),\n    ],\n    cwd: apiDir,\n    env,\n  })\n}\n\nexport const startAgentBackend = async () => {\n  if (await isTcpPortReachable(agentBackendHost, agentBackendPort)) {\n    const listenerDescription = await getTcpPortListenerDescription(agentBackendPort)\n    const listenerMessage = listenerDescription ? `\\n\\nPort listener:\\n${listenerDescription}` : ''\n\n    throw new Error(\n      `Cannot start the E2E Agent backend because ${agentBackendHost}:${agentBackendPort} is already in use.${listenerMessage}`,\n    )\n  }\n\n  await runForegroundProcess({\n    command: 'uv',\n    args: [\n      'run',\n      '--project',\n      '.',\n      '--extra',\n      'server',\n      'uvicorn',\n      'dify_agent.server.app:app',\n      '--host',\n      agentBackendBindHost,\n      '--port',\n      String(agentBackendPort),","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/e2e/scripts/setup.ts#L335-L371","documentation":"Error \"Cannot start the E2E Agent backend because ${agentBackendHost}:${agentBackendPort} is already in use.${listenerMessage}\" thrown in langgenius/dify.","triggerScenarios":"Thrown at e2e/scripts/setup.ts:353 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}