hcengineering/platform · error
No default content adapter
Error message
No default content adapter
What it means
createContentAdapter builds a map of content adapters from configuration and selects the one whose contentType matches the configured default. If no registered adapter matches the defaultContentAdapter key, defaultAdapter stays undefined and this error is thrown instead of returning a ContentAdapter.
Source
Thrown at foundations/server/packages/core/src/content.ts:49
export async function createContentAdapter (
contentAdapters: Record<string, ContentTextAdapterConfiguration>,
defaultContentAdapter: string
): Promise<ContentTextAdapter> {
const adapters = new Map<string, ContentTextAdapter>()
let defaultAdapter: ContentTextAdapter | undefined
for (const key in contentAdapters) {
const adapterConf = contentAdapters[key]
const adapter = await adapterConf.factory(adapterConf.url)
adapters.set(adapterConf.contentType, adapter)
if (key === defaultContentAdapter) {
defaultAdapter = adapter
}
}
if (defaultAdapter === undefined) {
throw new Error('No default content adapter')
}
return new ContentAdapter(adapters, defaultAdapter)
}
View on GitHub (pinned to 63e28dc964)
Solutions
- Check the config passed to startIndexer: ensure defaultContentAdapter exactly matches one adapter's contentType
- Add or re-register an adapter for the configured default contentType
- Fix the typo/case mismatch between the default name and adapter contentType keys
Example fix
// before
adapters: [{ contentType: 'text/markdown' }], defaultContentAdapter: 'text/md'
// after
adapters: [{ contentType: 'text/markdown' }], defaultContentAdapter: 'text/markdown' Defensive patterns
Strategy: validation
Validate before calling
const conf = getConf()
const hasDefault = conf.adapters.some(a => a.contentType === conf.defaultContentAdapter)
if (!hasDefault) throw new Error(`defaultContentAdapter '${conf.defaultContentAdapter}' has no matching adapter`) Type guard
function hasDefaultAdapter(conf: { adapters: { contentType: string }[]; defaultContentAdapter: string }): boolean {
return conf.adapters.some(a => a.contentType === conf.defaultContentAdapter)
} Try / catch
try {
const adapter = createContentAdapter(...)
} catch (err) {
if (err instanceof Error && err.message === 'No default content adapter') {
// fix config and retry / surface config error
} else throw err
} Prevention
- Keep defaultContentAdapter and adapter contentType values in one shared constant
- Validate adapter config at startup before indexing begins
- Add a unit test asserting every config profile defines a matching default
When it happens
Trigger: Config lists adapters whose contentType values never equal the configured defaultContentAdapter key; or defaultContentAdapter names a contentType that has no adapter registered (typo, adapter omitted from config array).
Common situations: Typo in the default adapter name in workspace/server config; deploying with a custom content pipeline config where the default adapter section was removed; renaming a contentType in code without updating config.
Related errors
- No screen access granted
- Unable to find ${RUSH_JSON_FILENAME}.
- Accounts url not specified
- Workspace ${options.workspace} not found
- Failed to fetch config
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/92bcd839cda3fba1.
Report an issue: GitHub.