{"record":{"id":"ab47ce4bf44e6992","repo":"laurent22/joplin","slug":"has-more-support-not-implemented","errorCode":null,"errorMessage":"has_more support not implemented","messagePattern":"has_more support not implemented","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/lib/file-api-driver-joplinServer.ts","lineNumber":307,"sourceCode":"\n\tpublic async releaseLock(type: LockType, clientType: LockClientType, clientId: string) {\n\t\tawait this.api().exec('DELETE', `api/locks/${type}_${clientType}_${clientId}`);\n\t}\n\n\tpublic async listLocks() {\n\t\treturn this.api().exec('GET', 'api/locks');\n\t}\n\n\tpublic async clearRoot(path: string) {\n\t\tconst response = await this.list(path);\n\n\t\tfor (const item of response.items) {\n\t\t\tawait this.delete(item.path);\n\t\t}\n\n\t\tawait this.api().exec('POST', 'api/debug', null, { action: 'clearKeyValues' });\n\n\t\tif (response.hasMore) throw new Error('has_more support not implemented');\n\t}\n}\n","sourceCodeStart":289,"sourceCodeEnd":310,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/lib/file-api-driver-joplinServer.ts#L289-L310","documentation":"Thrown by clearRoot() on the Joplin Server driver after deleting all listed items and clearing key values. If the initial list() returned hasMore === true, the driver has no pagination support in this debug/clear path and aborts rather than silently leaving items behind. It guards an incomplete implementation against partial cleanup.","triggerScenarios":"Calling clearRoot() (used by sync reset / debug wipe) on a Joplin Server target that contains more items than fit in a single list response page.","commonSituations":"Running a sync debug/reset on a large Joplin Server account; CI test fixtures that over-populate the root; a real account with many items where the dev intentionally wipes the target.","solutions":["Paginate: call list() in a loop following context.nextLink until hasMore is false, deleting items each pass, before the clearKeyValues call.","Reduce the number of items in the target below one page before clearing.","Use the server-side clearKeyValues debug action alone if full deletion isn't required.","Implement has_more handling in the driver's clearRoot as a proper fix."],"exampleFix":"// before\npublic async clearRoot(path: string) {\n  const response = await this.list(path);\n  for (const item of response.items) await this.delete(item.path);\n  await this.api().exec('POST', 'api/debug', null, { action: 'clearKeyValues' });\n  if (response.hasMore) throw new Error('has_more support not implemented');\n}\n// after - drain pages first\npublic async clearRoot(path: string) {\n  let ctx: any = null;\n  do {\n    const response = await this.list(path, { context: ctx });\n    for (const item of response.items) await this.delete(item.path);\n    ctx = response.context;\n  } while (response.hasMore);\n  await this.api().exec('POST', 'api/debug', null, { action: 'clearKeyValues' });\n}","handlingStrategy":"validation","validationCode":"// Don't call clearRoot on huge targets; or paginate yourself first.\nconst preview = await driver.list(path);\nif (preview.hasMore) throw new Error('Clear root needs pagination; implement or shrink target.');","typeGuard":"function isHasMoreNotImplemented(e: any): boolean {\n  return e && typeof e.message === 'string' && e.message.includes('has_more support not implemented');\n}","tryCatchPattern":"try {\n  await driver.clearRoot(path);\n} catch (e) {\n  if (isHasMoreNotImplemented(e)) {\n    // drain pages manually, then retry clearRoot\n    let ctx = null;\n    do { const r = await driver.list(path, { context: ctx }); for (const it of r.items) await driver.delete(it.path); ctx = r.context; } while (r.hasMore);\n    await driver.api().exec('POST', 'api/debug', null, { action: 'clearKeyValues' });\n    return;\n  }\n  throw e;\n}","preventionTips":["Avoid clearRoot on production-sized accounts; reserve it for test/debug fixtures.","Keep test fixture item counts below one list page.","If you need full wipe on large accounts, implement pagination in the driver.","Prefer server-side clearKeyValues when item deletion isn't required."],"tags":["joplin-server","sync","pagination","clear"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}