{"record":{"id":"b0dbbff515354435","repo":"supermemoryai/supermemory","slug":"customid-is-required-and-must-be-a-non-empty-strin","errorCode":null,"errorMessage":"customId is required and must be a non-empty string — provide it via `options.customId`","messagePattern":"customId is required and must be a non-empty string — provide it via `options\\.customId`","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tools/src/voltagent/middleware.ts","lineNumber":98,"sourceCode":"\t\tmode = \"profile\",\n\t\taddMemory = \"always\", // VoltAgent default: save conversations by default for chat apps\n\t\tbaseUrl,\n\t\tpromptTemplate,\n\t\tthreshold,\n\t\tlimit,\n\t\trerank,\n\t\trewriteQuery,\n\t\tfilters,\n\t\tinclude,\n\t\tmetadata,\n\t\tsearchMode,\n\t\tentityContext,\n\t\tverbose = false,\n\t} = options\n\n\t// Runtime validation: customId is required\n\tif (!customId || typeof customId !== \"string\" || customId.trim() === \"\") {\n\t\tthrow new Error(\n\t\t\t\"customId is required and must be a non-empty string — provide it via `options.customId`\",\n\t\t)\n\t}\n\n\tconst logger = createLogger(verbose)\n\tconst normalizedBaseUrl = normalizeBaseUrl(baseUrl)\n\n\tconst client = new Supermemory({\n\t\tapiKey,\n\t\t...(normalizedBaseUrl !== \"https://api.supermemory.ai\"\n\t\t\t? { baseURL: normalizedBaseUrl }\n\t\t\t: {}),\n\t})\n\n\treturn {\n\t\tclient,\n\t\tlogger,\n\t\tcontainerTag,","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/supermemoryai/supermemory/blob/d436792e777a99865939dd543c8d1a16d57f54ec/packages/tools/src/voltagent/middleware.ts#L80-L116","documentation":"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.","triggerScenarios":"Passing customId: undefined, '', '   ', or a non-string (number/object) in the SupermemoryVoltAgent options — often from a config file or env-derived value.","commonSituations":"Agent YAML/JSON config where customId was omitted; whitespace-only id from a bad template string; id typed as number in a dynamic config.","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"],"exampleFix":"// before\ncreateSupermemoryContext('user-1', { customId: cfg.customId })\n\n// after\nconst customId = String(cfg.customId ?? '').trim()\nif (!customId) throw new Error('customId missing in agent config')\ncreateSupermemoryContext('user-1', { customId })","handlingStrategy":"type-guard","validationCode":"const customId = typeof cfg.customId === 'string' ? cfg.customId.trim() : ''; if (!customId) throw new TypeError('customId must be non-empty string')","typeGuard":"const isNonEmptyString = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0","tryCatchPattern":null,"preventionTips":["Parse agent config with zod to validate customId up front","Never pass raw external config values into middleware constructors"],"tags":["validation","voltagent","configuration","supermemory"],"backgroundTag":"missing-required-option","analyzedSha":"d436792e777a99865939dd543c8d1a16d57f54ec","analyzedAt":"2026-08-28T18:04:46.947Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}