supermemoryai/supermemory · error · Error

Supermemory API request failed: ${error}

Error message

Supermemory API request failed: ${error}

What it means

Catch-all in the shared memory client's supermemoryProfileSearch that wraps non-Error rejections (strings, objects, abort DOMExceptions) into a proper Error so downstream code can rely on instanceof Error. The original value appears in the message.

Source

Thrown at packages/tools/src/shared/memory-client.ts:63

				Authorization: `Bearer ${apiKey}`,
			},
			body: payload,
			...(signal ? { signal } : {}),
		})

		if (!response.ok) {
			const errorText = await response.text().catch(() => "Unknown error")
			throw new Error(
				`Supermemory profile search failed: ${response.status} ${response.statusText}. ${errorText}`,
			)
		}

		return await response.json()
	} catch (error) {
		if (error instanceof Error) {
			throw error
		}
		throw new Error(`Supermemory API request failed: ${error}`)
	}
}

/**
 * Options for building memories text.
 */
export interface BuildMemoriesTextOptions {
	containerTag: string
	queryText: string
	mode: MemoryMode
	baseUrl: string
	apiKey: string
	logger: Logger
	promptTemplate?: PromptTemplate
	signal?: AbortSignal
}

/**

View on GitHub (pinned to d436792e77)

Solutions

  1. Inspect the message to identify the underlying rejection (abort, network, custom fetch)
  2. Handle timeouts explicitly with retry or graceful degradation
  3. Use a runtime with standards-compliant fetch rejection behavior

Example fix

// before
await supermemoryProfileSearch(payload)

// after
try {
  return await supermemoryProfileSearch(payload)
} catch (e) {
  if (e instanceof Error && e.message.toLowerCase().includes('abort')) return { results: [] }
  throw e
}
Defensive patterns

Strategy: try-catch

Try / catch

try { await supermemoryProfileSearch(p) } catch (e) { if (e instanceof Error && /abort|timeout/i.test(e.message)) return { results: [] }; throw e }

Prevention

When it happens

Trigger: fetch rejecting with an abort/timeout signal or a non-Error value in certain runtimes (edge runtimes, older Node, polyfilled fetch).

Common situations: Requests exceeding the timeout on slow connections; edge runtimes with non-standard fetch behavior.

Related errors


AI-assisted analysis of supermemoryai/supermemory@d436792e77 (2026-08-28). Data as JSON: /api/errors/2cc4a27ed057071d. Report an issue: GitHub.