jackwener/OpenCLI · error · CommandExecutionError

quark: Folder "${part}" not found in "${path}"

Error message

quark: Folder "${part}" not found in "${path}"

What it means

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.

Source

Thrown at clis/quark/utils.js:114

        const data = await fetchJson(page, url);
        const files = unwrapApiData(data, 'Failed to list drive')?.list || [];
        allFiles.push(...files);
        total = data.metadata?._total || 0;
        pageNum++;
    } while (allFiles.length < total);
    return allFiles;
}
export async function findFolder(page, path) {
    const parts = path.split('/').filter(Boolean);
    let currentFid = '0';
    for (const part of parts) {
        const files = await listMyDrive(page, currentFid);
        const existing = files.find(f => f.dir && f.file_name === part);
        if (existing) {
            currentFid = existing.fid;
        }
        else {
            throw new CommandExecutionError(`quark: Folder "${part}" not found in "${path}"`);
        }
    }
    return currentFid;
}
export function formatDate(ts) {
    if (!ts)
        return '';
    const d = new Date(ts);
    return d.toISOString().replace('T', ' ').slice(0, 19);
}
export function formatSize(bytes) {
    if (bytes <= 0)
        return '0 B';
    const units = ['B', 'KB', 'MB', 'GB', 'TB'];
    const i = Math.floor(Math.log(bytes) / Math.log(1024));
    return `${(bytes / Math.pow(1024, i)).toFixed(2)} ${units[i]}`;
}
export async function getTaskStatus(page, taskId) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. List the drive (listMyDrive) and confirm the exact folder names/case, then correct the path string.
  2. Create the missing folder in Quark (or via the create-folder API) before resolving the path.
  3. Ensure the logged-in account is the one that owns the folder.
  4. Strip stray whitespace/slashes from the path before calling.

Example fix

// before
const fid = await findFolder(page, '/Backups/2026/ August');
// after
const fid = await findFolder(page, '/Backups/2026/August'.split('/').filter(Boolean).join('/'));
Defensive patterns

Strategy: validation

Validate before calling

const files = await listMyDrive(page, parentFid);
const want = 'August';
if (!files.some(f => f.dir && f.file_name === want)) {
  console.error(`Folder "${want}" missing; available:`, files.filter(f => f.dir).map(f => f.file_name));
  return; // fix path or create folder before calling findFolder
}

Type guard

function folderExists(files, name) {
  return files.some(f => f.dir && f.file_name === name);
}

Try / catch

try {
  const fid = await findFolder(page, path);
} catch (e) {
  if (String(e.message).startsWith('quark: Folder')) {
    console.error('Path not found:', e.message);
  } else { throw e; }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/1e807989eb643c61. Report an issue: GitHub.