{"record":{"id":"9b1d95ac790ba62f","repo":"Tencent/WeKnora","slug":"api-key-is-required-for-exa-provider","errorCode":null,"errorMessage":"API key is required for Exa provider","messagePattern":"API key is required for Exa provider","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/web_search_provider.go","lineNumber":177,"sourceCode":"\t\t}\n\t\tif params.EngineID == \"\" {\n\t\t\treturn fmt.Errorf(\"engine ID is required for Google provider\")\n\t\t}\n\tcase types.WebSearchProviderTypeTavily:\n\t\tif params.APIKey == \"\" {\n\t\t\treturn fmt.Errorf(\"API key is required for Tavily provider\")\n\t\t}\n\tcase types.WebSearchProviderTypeOllama:\n\t\tif params.APIKey == \"\" {\n\t\t\treturn fmt.Errorf(\"API key is required for Ollama provider\")\n\t\t}\n\tcase types.WebSearchProviderTypeBaidu:\n\t\tif params.APIKey == \"\" {\n\t\t\treturn fmt.Errorf(\"API key is required for Baidu provider\")\n\t\t}\n\tcase types.WebSearchProviderTypeExa:\n\t\tif params.APIKey == \"\" {\n\t\t\treturn fmt.Errorf(\"API key is required for Exa provider\")\n\t\t}\n\tcase types.WebSearchProviderTypeZhipu:\n\t\tif err := infra_web_search.ValidateZhipuParameters(params); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase types.WebSearchProviderTypeMetaso:\n\t\tif err := infra_web_search.ValidateMetasoParameters(params); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase types.WebSearchProviderTypeDuckDuckGo:\n\t\t// No API key required\n\tcase types.WebSearchProviderTypeKeenable:\n\t\t// No API key required (keyless by default; an optional key lifts the rate limit)\n\tcase types.WebSearchProviderTypeSearxng:\n\t\tif err := infra_web_search.ValidateSearxngBaseURL(params.BaseURL); err != nil {\n\t\t\treturn err\n\t\t}\n\t}","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/web_search_provider.go#L159-L195","documentation":"validateProviderParameters requires a non-empty APIKey for the Exa web-search provider. Exa's API is key-authenticated, so creating, updating, or test-validating an Exa provider without params.APIKey fails with this error.","triggerScenarios":"CreateProvider or UpdateProvider with type 'exa' and APIKey == \"\"; tests (e.g. TestValidateProviderParametersExa) that construct Exa params without a key.","commonSituations":"Signing up for Exa but not copying the API key into config; rotating keys and leaving the field empty temporarily; YAML/JSON config where the key is nested under the wrong field so it unmarshals empty.","solutions":["Set params.APIKey to a valid Exa API key from the Exa dashboard before saving the provider.","Check config binding/marshalling so the key lands in the APIKey field, not a sibling field.","Ensure the secret is present in the environment/secret store at startup.","Strip quotes/whitespace that can make the loaded value look empty or invalid after trimming."],"exampleFix":"// before\n{ \"type\": \"exa\", \"apiKey\": \"\" }\n// after\n{ \"type\": \"exa\", \"apiKey\": \"<your-exa-api-key>\" }","handlingStrategy":"validation","validationCode":"if provider.Type == types.WebSearchProviderTypeExa && strings.TrimSpace(provider.APIKey) == \"\" {\n\treturn errors.New(\"exa provider requires an API key\")\n}","typeGuard":null,"tryCatchPattern":"err := svc.CreateProvider(ctx, p)\nif err != nil && strings.Contains(err.Error(), \"required for Exa\") {\n\t// prompt the user for their Exa API key before retrying\n\treturn fieldError(\"apiKey\", err)\n}","preventionTips":["Copy the Exa key at setup time and verify it via a cheap API ping before saving.","Centralize provider creation through a helper that enforces key presence per type.","Keep keys out of committed config; inject via env and fail fast when missing.","Re-validate providers after key rotation."],"tags":["validation","web-search","api-key","exa"],"backgroundTag":"missing-api-key","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}