supermemoryai/supermemory · error · Error
customId is required and must be a non-empty string — provid
Error message
customId is required and must be a non-empty string — provide it via `options.customId`
What it means
createSupermemoryContext runtime-validates that customId is a non-empty, non-whitespace string before building the middleware context, because VoltAgent config comes from untyped user-supplied agent definitions.
Source
Thrown at packages/tools/src/voltagent/middleware.ts:98
mode = "profile",
addMemory = "always", // VoltAgent default: save conversations by default for chat apps
baseUrl,
promptTemplate,
threshold,
limit,
rerank,
rewriteQuery,
filters,
include,
metadata,
searchMode,
entityContext,
verbose = false,
} = options
// Runtime validation: customId is required
if (!customId || typeof customId !== "string" || customId.trim() === "") {
throw new Error(
"customId is required and must be a non-empty string — provide it via `options.customId`",
)
}
const logger = createLogger(verbose)
const normalizedBaseUrl = normalizeBaseUrl(baseUrl)
const client = new Supermemory({
apiKey,
...(normalizedBaseUrl !== "https://api.supermemory.ai"
? { baseURL: normalizedBaseUrl }
: {}),
})
return {
client,
logger,
containerTag,View on GitHub (pinned to d436792e77)
Solutions
- Ensure customId is a trimmed non-empty string, e.g. a conversation or agent-run id
- Trim/validate config values before constructing the middleware
- Add a schema (zod) around your agent config to catch this at load time
Example fix
// before
createSupermemoryContext('user-1', { customId: cfg.customId })
// after
const customId = String(cfg.customId ?? '').trim()
if (!customId) throw new Error('customId missing in agent config')
createSupermemoryContext('user-1', { customId }) Defensive patterns
Strategy: type-guard
Validate before calling
const customId = typeof cfg.customId === 'string' ? cfg.customId.trim() : ''; if (!customId) throw new TypeError('customId must be non-empty string') Type guard
const isNonEmptyString = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0
Prevention
- Parse agent config with zod to validate customId up front
- Never pass raw external config values into middleware constructors
When it happens
Trigger: Passing customId: undefined, '', ' ', or a non-string (number/object) in the SupermemoryVoltAgent options — often from a config file or env-derived value.
Common situations: Agent YAML/JSON config where customId was omitted; whitespace-only id from a bad template string; id typed as number in a dynamic config.
Related errors
- Supermemory tools config accepts either projectId or contain
- customId is required — provide a non-empty string to group m
- SUPERMEMORY_API_KEY is not set — provide it via `options.api
- withSupermemory: options must be an object with required con
- containerTag is required — provide a non-empty string to ide
AI-assisted analysis of supermemoryai/supermemory@d436792e77 (2026-08-28).
Data as JSON: /api/errors/b0dbbff515354435.
Report an issue: GitHub.