TencentCloud/TencentDB-Agent-Memory · error
EmbeddingService: baseUrl is required for remote provider
Error message
EmbeddingService: baseUrl is required for remote provider
What it means
The remote (OpenAI-compatible) EmbeddingService requires a baseUrl pointing at the embedding HTTP endpoint. Without it no requests can be issued, so the constructor throws immediately. This is fail-fast validation of OpenAIEmbeddingConfig.
Source
Thrown at MemoryCore/src/core/store/embedding.ts:419
export class OpenAIEmbeddingService implements EmbeddingService {
private readonly baseUrl: string;
private readonly apiKey: string;
private readonly model: string;
private readonly dims: number;
private readonly sendDimensions: boolean;
private readonly providerName: string;
private readonly proxyUrl?: string;
private readonly maxInputChars?: number;
private readonly timeoutMs: number;
private readonly logger?: Logger;
constructor(config: OpenAIEmbeddingConfig, logger?: Logger) {
if (!config.apiKey) {
throw new Error("EmbeddingService: apiKey is required for remote provider");
}
if (!config.baseUrl) {
throw new Error("EmbeddingService: baseUrl is required for remote provider");
}
if (!config.model) {
throw new Error("EmbeddingService: model is required for remote provider");
}
if (!config.dimensions || config.dimensions <= 0) {
throw new Error("EmbeddingService: dimensions is required for remote provider (must be a positive integer)");
}
this.baseUrl = config.baseUrl.replace(/\/+$/, "");
this.apiKey = config.apiKey;
this.model = config.model;
this.dims = config.dimensions;
this.sendDimensions = config.sendDimensions ?? true;
this.providerName = config.provider || "openai";
this.proxyUrl = config.proxyUrl?.trim() || undefined;
this.maxInputChars = config.maxInputChars && config.maxInputChars > 0 ? config.maxInputChars : undefined;
this.timeoutMs = config.timeoutMs && config.timeoutMs > 0 ? config.timeoutMs : DEFAULT_API_TIMEOUT_MS;
this.logger = logger;
}View on GitHub (pinned to 3efcd317b8)
Solutions
- Set config.baseUrl to the provider endpoint (e.g. https://api.openai.com/v1), with or without a trailing slash (trailing slashes are stripped)
- Verify the config file/plugin settings actually populate tcvdb/embedding baseUrl before construction
- Use the provider's documented base URL for the embedding API version you target
Example fix
// before
new EmbeddingService({ apiKey: key, model: 'text-embedding-3-small', dimensions: 1536 })
// after
new EmbeddingService({ apiKey: key, baseUrl: 'https://api.openai.com/v1', model: 'text-embedding-3-small', dimensions: 1536 }) Defensive patterns
Strategy: validation
Validate before calling
function assertBaseUrl(cfg) {
const url = cfg?.baseUrl;
if (!url || typeof url !== 'string' || !url.trim()) throw new Error('baseUrl is required');
new URL(url);
return cfg;
}
assertBaseUrl(config); Type guard
function hasBaseUrl(cfg): cfg is OpenAIEmbeddingConfig & { baseUrl: string } {
return typeof cfg?.baseUrl === 'string' && cfg.baseUrl.trim().length > 0;
} Try / catch
try {
svc = new EmbeddingService(config, logger);
} catch (e) {
if (String(e.message).includes('baseUrl is required')) {
throw new ConfigError('Embedding baseUrl missing — set it to e.g. https://api.openai.com/v1');
}
throw e;
} Prevention
- Keep all provider endpoint URLs in one config module with defaults
- Validate the full OpenAIEmbeddingConfig once at startup, not ad hoc
- Document required fields in the config schema (JSON schema/zod)
When it happens
Trigger: `new EmbeddingService(config)` where config.apiKey is present but config.baseUrl is undefined, null, or empty.
Common situations: Config built programmatically with only apiKey/model set, migration from a library version where baseUrl had a default, or loading a config file that omitted the baseUrl field.
Related errors
- EmbeddingService: apiKey is required for remote provider
- EmbeddingService: model is required for remote provider
- EmbeddingService: dimensions is required for remote provider
- [skill-worker-pool] concurrency must be positive integer, go
- llm.provider=proxy 需要 memory 系统用户 key —— 请在 yaml metadata.sy
AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01).
Data as JSON: /api/errors/bf72366b50e3244a.
Report an issue: GitHub.