supermemoryai/supermemory · error · Error
Supermemory tools config accepts either projectId or contain
Error message
Supermemory tools config accepts either projectId or containerTags, not both.
What it means
getContainerTags enforces mutually exclusive configuration: you may scope Supermemory tools by projectId OR by an explicit containerTags array, never both, because projectId is just sugar for a project-prefixed container tag and mixing them is ambiguous.
Source
Thrown at packages/tools/src/tools-shared.ts:67
limit: 10,
chunkThreshold: 0.6,
} as const
// Container tag constants
export const CONTAINER_TAG_CONSTANTS = {
projectPrefix: "sm_project_",
defaultTags: ["sm_project_default"] as string[],
} as const
/**
* Helper function to generate container tags based on config
*/
export function getContainerTags(config?: {
projectId?: string
containerTags?: string[]
}): string[] {
if (config?.projectId !== undefined && config.containerTags !== undefined) {
throw new Error(
"Supermemory tools config accepts either projectId or containerTags, not both.",
)
}
if (config?.projectId) {
return [`${CONTAINER_TAG_CONSTANTS.projectPrefix}${config.projectId}`]
}
return config?.containerTags ?? CONTAINER_TAG_CONSTANTS.defaultTags
}
/**
* Memory item interface representing a single memory with optional metadata
*/
export interface MemoryItem {
memory: string
metadata?: Record<string, unknown>
}
/**View on GitHub (pinned to d436792e77)
Solutions
- Remove one of the two fields — prefer projectId for project scoping
- If merging configs, delete containerTags when projectId is set
- Add a type helper (Exact or a guard) so TS rejects both fields at compile time
Example fix
// before
const config = { projectId: 'p1', containerTags: ['user-1'] }
// after
const config = { projectId: 'p1' } Defensive patterns
Strategy: validation
Validate before calling
if (config.projectId !== undefined && config.containerTags !== undefined) throw new TypeError('pass either projectId or containerTags') Type guard
type ToolsConfig = { projectId: string; containerTags?: undefined } | { projectId?: undefined; containerTags: string[] } Prevention
- Use a discriminated union type so TS rejects both fields
- Delete legacy containerTags when adopting projectId
When it happens
Trigger: Passing a tools config like { projectId: 'p1', containerTags: ['user-1'] } to Supermemory tools that accept both fields.
Common situations: Migrating from containerTags to projectId and leaving the old field in the config; merging default config objects that each set a different field.
Related errors
- customId is required — provide a non-empty string to group m
- customId is required and must be a non-empty string — provid
- withSupermemory: options must be an object with required con
- containerTag is required — provide a non-empty string to ide
- customId is required — provide a non-empty string to group m
AI-assisted analysis of supermemoryai/supermemory@d436792e77 (2026-08-28).
Data as JSON: /api/errors/d89c88512b5938f5.
Report an issue: GitHub.