{"record":{"id":"1e807989eb643c61","repo":"jackwener/OpenCLI","slug":"quark-folder-part-not-found-in-path","errorCode":null,"errorMessage":"quark: Folder \"${part}\" not found in \"${path}\"","messagePattern":"quark: Folder \"(.+?)\" not found in \"(.+?)\"","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/quark/utils.js","lineNumber":114,"sourceCode":"        const data = await fetchJson(page, url);\n        const files = unwrapApiData(data, 'Failed to list drive')?.list || [];\n        allFiles.push(...files);\n        total = data.metadata?._total || 0;\n        pageNum++;\n    } while (allFiles.length < total);\n    return allFiles;\n}\nexport async function findFolder(page, path) {\n    const parts = path.split('/').filter(Boolean);\n    let currentFid = '0';\n    for (const part of parts) {\n        const files = await listMyDrive(page, currentFid);\n        const existing = files.find(f => f.dir && f.file_name === part);\n        if (existing) {\n            currentFid = existing.fid;\n        }\n        else {\n            throw new CommandExecutionError(`quark: Folder \"${part}\" not found in \"${path}\"`);\n        }\n    }\n    return currentFid;\n}\nexport function formatDate(ts) {\n    if (!ts)\n        return '';\n    const d = new Date(ts);\n    return d.toISOString().replace('T', ' ').slice(0, 19);\n}\nexport function formatSize(bytes) {\n    if (bytes <= 0)\n        return '0 B';\n    const units = ['B', 'KB', 'MB', 'GB', 'TB'];\n    const i = Math.floor(Math.log(bytes) / Math.log(1024));\n    return `${(bytes / Math.pow(1024, i)).toFixed(2)} ${units[i]}`;\n}\nexport async function getTaskStatus(page, taskId) {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/quark/utils.js#L96-L132","documentation":"CommandExecutionError thrown by findFolder when, while walking a slash-separated path segment by segment, listMyDrive returns no directory whose file_name equals the current segment. It signals the requested folder path does not exist under the Quark drive root/parent.","triggerScenarios":"Calling findFolder (via rootFid/parentFid/targetFid helpers) with a path containing a segment that is not an existing folder, is misspelled, or exists but as a file (f.dir false) rather than a directory.","commonSituations":"Typo or trailing-space in folder name; folder was renamed/deleted on the Quark web UI; path uses wrong separator or case; user querying a different account's drive than the one holding the folder.","solutions":["List the drive (listMyDrive) and confirm the exact folder names/case, then correct the path string.","Create the missing folder in Quark (or via the create-folder API) before resolving the path.","Ensure the logged-in account is the one that owns the folder.","Strip stray whitespace/slashes from the path before calling."],"exampleFix":"// before\nconst fid = await findFolder(page, '/Backups/2026/ August');\n// after\nconst fid = await findFolder(page, '/Backups/2026/August'.split('/').filter(Boolean).join('/'));","handlingStrategy":"validation","validationCode":"const files = await listMyDrive(page, parentFid);\nconst want = 'August';\nif (!files.some(f => f.dir && f.file_name === want)) {\n  console.error(`Folder \"${want}\" missing; available:`, files.filter(f => f.dir).map(f => f.file_name));\n  return; // fix path or create folder before calling findFolder\n}","typeGuard":"function folderExists(files, name) {\n  return files.some(f => f.dir && f.file_name === name);\n}","tryCatchPattern":"try {\n  const fid = await findFolder(page, path);\n} catch (e) {\n  if (String(e.message).startsWith('quark: Folder')) {\n    console.error('Path not found:', e.message);\n  } else { throw e; }\n}","preventionTips":["Normalize paths (trim, split('/').filter(Boolean)) before resolving","Pre-list parent folders to verify names and case","Create missing folders programmatically before resolving","Confirm you are on the account that owns the tree"],"tags":["filesystem","not-found","path"],"backgroundTag":"folder-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}