{"record":{"id":"7b1c7364d7d7e83d","repo":"Tencent/WeKnora","slug":"create-tencent-vectordb-client-w","errorCode":null,"errorMessage":"create tencent vectordb client: %w","messagePattern":"create tencent vectordb client: %w","errorType":"exception","errorClass":null,"httpStatus":500,"severity":"error","filePath":"internal/container/engine_factory.go","lineNumber":387,"sourceCode":"// hostFromAddr 从 \"host:port\" 中拆出 host 部分；Addr 没有冒号时整段当作 host。\nfunc hostFromAddr(addr string) string {\n\tif i := strings.LastIndex(addr, \":\"); i > 0 {\n\t\treturn addr[:i]\n\t}\n\treturn addr\n}\n\nfunc createTencentVectorDBEngine(store types.VectorStore) (interfaces.RetrieveEngineService, error) {\n\tcc := store.ConnectionConfig\n\tclient, err := tcvectordb.NewRpcClient(cc.Addr, cc.Username, cc.APIKey, &tcvectordb.ClientOption{\n\t\tReadConsistency: tcvectordb.EventualConsistency,\n\t\tTimeout:         10 * time.Second,\n\t\tTransport: &utils.SSRFValidatingRoundTripper{\n\t\t\tBase: utils.NewSSRFSafeTransport(utils.DefaultSSRFSafeHTTPClientConfig()),\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create tencent vectordb client: %w\", err)\n\t}\n\trepo := tencentVectorDBRepo.NewTencentVectorDBRetrieveEngineRepository(client, cc.Database, &store.IndexConfig)\n\treturn retriever.NewKVHybridRetrieveEngine(repo, types.TencentVectorDBRetrieverEngineType), nil\n}\n","sourceCodeStart":369,"sourceCodeEnd":392,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/container/engine_factory.go#L369-L392","documentation":"This wraps an error from the Tencent VectorDB Go SDK client constructor in createTencentVectorDBEngine. The client is built with credentials, timeout, and an SSRF-validating transport; construction errors indicate invalid credentials/endpoint configuration or SDK-level setup failure before any request is issued.","triggerScenarios":"createEngineServiceFromStore dispatching to a Tencent VectorDB store with a missing/invalid Username/APIKey, bad endpoint host, or SDK constructor rejecting the supplied options (e.g. incompatible transport or timeout configuration).","commonSituations":"Empty TENCENT_VECTORDB_USERNAME/KEY env vars; wrong region endpoint URL; SDK version upgrade changing the client option struct; account lacks vectordb enablement so the SDK rejects the config.","solutions":["Verify cc.Username and cc.APIKey are both set and free of whitespace/quotes","Confirm the endpoint URL points at the correct Tencent Cloud region vectorDB endpoint","Check the SDK version's client option struct matches the fields being set here","Enable SDK debug logging to see the precise constructor error wrapped by this message"],"exampleFix":"// before\ncc := types.ConnectionConfig{Username: \"\", APIKey: os.Getenv(\"VDB_KEY\")} // VDB_KEY unset\n// after\ncc := types.ConnectionConfig{Username: \"root\", APIKey: mustEnv(\"TENCENT_VECTORDB_KEY\")}","handlingStrategy":"validation","validationCode":"func validTencentVDBConfig(cc types.ConnectionConfig) error {\n    if cc.Username == \"\" { return errors.New(\"tencent vectordb username required\") }\n    if cc.APIKey == \"\" { return errors.New(\"tencent vectordb api key required\") }\n    u, err := url.Parse(cc.Addr)\n    if err != nil || u.Host == \"\" { return fmt.Errorf(\"tencent vectordb endpoint invalid: %q\", cc.Addr) }\n    return nil\n}","typeGuard":"func tencentVDBReady(cc types.ConnectionConfig) bool { return cc.Username != \"\" && cc.APIKey != \"\" && cc.Addr != \"\" }","tryCatchPattern":"engine, err := createEngineServiceFromStore(ctx, store)\nif err != nil && strings.Contains(err.Error(), \"create tencent vectordb client\") {\n    return fmt.Errorf(\"tencent vectordb config invalid: check username/apikey/endpoint: %w\", err)\n}","preventionTips":["Fail fast at startup if TENCENT_VECTORDB username/key env vars are unset","Verify the endpoint matches the correct region and account has VectorDB enabled","Trim credentials loaded from secrets/env to avoid stray whitespace","Pin the Tencent VectorDB SDK version and review option-struct changes on upgrade"],"tags":["tencent-vectordb","client-init","credentials","config"],"backgroundTag":"client-construction-failed","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}