{"record":{"id":"a35bb1306151d12f","repo":"microsoft/autogen","slug":"failed-to-test-component","errorCode":null,"errorMessage":"Failed to test component","messagePattern":"Failed to test component","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-studio/frontend/src/components/views/teambuilder/api.ts","lineNumber":114,"sourceCode":"    return data;\n  }\n\n  async testComponent(\n    component: Component<ComponentConfig>,\n    timeout: number = 60\n  ): Promise<ComponentTestResult> {\n    const response = await fetch(`${this.getBaseUrl()}/validate/test`, {\n      method: \"POST\",\n      headers: this.getHeaders(),\n      body: JSON.stringify({\n        component: component,\n        timeout: timeout,\n      }),\n    });\n\n    const data = await response.json();\n    if (!response.ok) {\n      throw new Error(data.message || \"Failed to test component\");\n    }\n\n    return data;\n  }\n}\n\nexport const teamAPI = new TeamAPI();\nexport const validationAPI = new ValidationAPI();\n","sourceCodeStart":96,"sourceCodeEnd":123,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-studio/frontend/src/components/views/teambuilder/api.ts#L96-L123","documentation":"Thrown by ValidationAPI.testComponent when POST /validate/test returns a non-2xx status after attempting to actually execute/test the component (with a default 60s timeout). The server message is preferred; this string is the fallback when the body lacks one. It means the test run of the component failed or could not start.","triggerScenarios":"Calling validationAPI.testComponent(component, timeout) where the sandboxed test fails: component's init raises (bad imports, missing dependencies), LLM call fails (invalid API key in config), the test exceeds the timeout, or the server returns 500 with an empty body. Message is the generic fallback only when data.message is absent.","commonSituations":"Testing an agent component whose model config has an invalid/missing API key; custom component code importing packages not installed in the server environment; timeout too short for a real LLM round-trip.","solutions":["Read the full error string — the server's message (e.g. 'API key not valid') is embedded when present.","Verify the component's model config contains a valid api_key before testing.","Increase the timeout argument for components that make real LLM calls.","If the component is custom code, run/test its __init__ and run logic locally against the same Python deps the server has."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!component.config) throw new Error('Component has no config to test');\nconst needsLlm = JSON.stringify(component).includes('\"model\"');\nif (needsLlm && !hasAnyApiKey(component.config)) {\n  throw new Error('Add a valid api_key to the model config before testing');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const result = await validationAPI.testComponent(component, 120);\n  displayTestResult(result);\n} catch (e) {\n  if (e instanceof Error && /timeout/i.test(e.message)) {\n    retryWithLongerTimeout(component);\n  } else {\n    setError(e instanceof Error ? e.message : 'Component test failed');\n  }\n}","preventionTips":["Pass an explicit timeout larger than the slowest LLM call the component makes.","Ensure model configs contain a valid api_key before testing.","Test custom component code locally against the server's Python dependencies first."],"tags":["http","typescript","frontend","autogen-studio","testing"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}