Crosstalk-Solutions/project-nomad · warning
Maximum of 10 custom libraries allowed
Error message
Maximum of 10 custom libraries allowed
What it means
The zim service enforces a hard cap of 10 user-defined custom library sources; addCustomLibrary throws when an 11th is attempted. The controller maps it to a 400 so the client sees a clean validation-style error instead of a 500.
Source
Thrown at admin/app/controllers/zim_controller.ts:197
const payload = await request.validateUsing(selectWikipediaValidator)
return this.zimService.selectWikipedia(payload.optionId)
}
// Custom library endpoints
async listCustomLibraries({}: HttpContext) {
return this.zimService.listCustomLibraries()
}
async addCustomLibrary({ request, response }: HttpContext) {
const payload = await request.validateUsing(addCustomLibraryValidator)
assertNotPrivateUrl(payload.base_url)
try {
const source = await this.zimService.addCustomLibrary(payload.name, payload.base_url)
return { message: 'Custom library added', library: source }
} catch (error) {
if (error.message === 'Maximum of 10 custom libraries allowed') {
return response.status(400).send({ message: error.message })
}
throw error
}
}
async removeCustomLibrary({ request, response }: HttpContext) {
const payload = await request.validateUsing(idParamValidator)
try {
await this.zimService.removeCustomLibrary(payload.params.id)
return { message: 'Custom library removed' }
} catch (error) {
if (error.message === 'Custom library not found') {
return response.status(404).send({ message: error.message })
}
throw error
}
}
View on GitHub (pinned to 0bd1c6f4f9)
Solutions
- Delete an existing custom library first (removeCustomLibrary endpoint) to free a slot, then retry the add
- Inspect the current custom library list via the state/read endpoint and deduplicate entries before adding
- If 10 is genuinely too few for your deployment, raise the limit in zimService.addCustomLibrary or persist the list externally
Example fix
// before
await zimController.addCustomLibrary({ name: 'new-lib', base_url: 'https://example.com/zim' }) // 400: Maximum of 10 custom libraries allowed
// after
await zimController.removeCustomLibrary(existingId)
await zimController.addCustomLibrary({ name: 'new-lib', base_url: 'https://example.com/zim' }) Defensive patterns
Strategy: validation
Validate before calling
const libs = await api.get('/zim/state') // or the libraries list endpoint
if (libs.customLibraries.length >= 10) {
throw new Error('Remove a custom library before adding another (max 10)')
}
await api.post('/zim/libraries', { name, base_url }) Try / catch
try {
await addCustomLibrary(name, url)
} catch (e) {
if (e.status === 400 && /Maximum of 10/.test(e.message)) {
// prompt user to remove one, or auto-evict oldest
} else throw e
} Prevention
- Show remaining quota (used/10) in the UI
- Auto-remove replaced libraries when re-adding by name
- Refresh the library list before every add
When it happens
Trigger: Calling POST to add a custom library when 10 custom library entries already exist in the zim settings/store (e.g. addCustomLibrary on an already-full list).
Common situations: Repeatedly re-adding libraries during testing without removing old ones; scripts provisioning sources accumulating entries over time; stale state persisting between environments.
Related errors
- Custom library not found
- ${error.message}
- Failed to fetch remote ZIM files.
- Upload failed
- Could not fetch directory listing from the provided URL
AI-assisted analysis of Crosstalk-Solutions/project-nomad@0bd1c6f4f9 (2026-08-27).
Data as JSON: /api/errors/cbfb249bb8a87132.
Report an issue: GitHub.