jackwener/OpenCLI · error · ArgumentError
No fids provided
Error message
No fids provided
What it means
clis/quark/mv.js splits the --fids argument on commas, trims and deduplicates into fidList. If nothing usable remains (fids empty or all entries blank), it throws ArgumentError('No fids provided') since a move operation needs at least one source file id.
Source
Thrown at clis/quark/mv.js:24
name: 'mv',
access: 'write',
description: 'Move files to a folder in your Quark Drive',
domain: 'pan.quark.cn',
strategy: Strategy.COOKIE,
defaultFormat: 'json',
args: [
{ name: 'fids', required: true, positional: true, help: 'File IDs to move (comma-separated)' },
{ name: 'to', default: '', help: 'Destination folder path (required unless --to-fid is set)' },
{ name: 'to-fid', default: '', help: 'Destination folder ID (overrides --to)' },
{ name: 'timeout', type: 'int', required: false, default: 120, help: 'Max seconds for the overall command (default: 120)' },
],
func: async (page, kwargs) => {
const to = kwargs.to;
const toFid = kwargs['to-fid'];
const fids = kwargs.fids;
const fidList = [...new Set(fids.split(',').map(id => id.trim()).filter(Boolean))];
if (fidList.length === 0)
throw new ArgumentError('No fids provided');
if (!to && !toFid)
throw new ArgumentError('Either --to or --to-fid is required');
if (to && toFid)
throw new ArgumentError('Cannot use both --to and --to-fid');
const targetFid = toFid || await findFolder(page, to);
const data = await apiPost(page, `${DRIVE_API}/move?pr=ucpro&fr=pc`, {
filelist: fidList,
to_pdir_fid: targetFid,
});
const result = {
status: 'pending',
count: fidList.length,
destination: to || toFid,
task_id: data.task_id,
completed: false,
};
if (data.task_id) {
const completed = await pollTask(page, data.task_id);View on GitHub (pinned to 49907e53dc)
Solutions
- Pass at least one real fid, e.g. `quark mv --fids fid1,fid2 --to /docs`.
- In scripts, build the fid list from actual file listings and skip the mv call when the array is empty.
- Strip whitespace and validate ids before composing the --fids string.
- Verify you are quoting the argument so commas aren't consumed by the shell.
Example fix
// before
const fids = ids.join(','); // '' when ids is empty
await run(['quark', 'mv', '--fids', fids, '--to', '/docs']);
// after
if (ids.length === 0) throw new Error('nothing to move');
const fids = ids.join(',');
await run(['quark', 'mv', '--fids', fids, '--to', '/docs']); Defensive patterns
Strategy: validation
Validate before calling
const fidList = [...new Set(fids.split(',').map(s => s.trim()).filter(Boolean))];
if (fidList.length === 0) throw new Error('Provide at least one fid in --fids'); Type guard
function hasFids(fidsArg) {
return typeof fidsArg === 'string' && fidsArg.split(',').some(s => s.trim() !== '');
} Try / catch
try {
await run(['quark', 'mv', '--fids', fids, '--to', dest]);
} catch (e) {
if (/No fids provided/.test(String(e.message))) {
console.error('--fids was empty or whitespace-only; supply comma-separated file ids.');
process.exitCode = 2;
} else throw e;
} Prevention
- Build --fids from a real listing, never from a possibly-empty join
- Validate id strings are non-empty and trim whitespace first
- Skip or short-circuit move operations when the source list is empty
- Quote the --fids argument so commas reach the CLI intact
When it happens
Trigger: Running quark mv with --fids "", --fids ",," or --fids " , " so the filtered fid list is empty; the mv command aborts before contacting the API.
Common situations: Upstream command producing an empty id list piped into --fids; trailing-comma-only string from a naive join of an empty array; variable holding fids unset in a script; whitespace-only input from manual typing.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Either --to or --to-fid is required
- Cannot use both --to and --to-fid
- ${label} cannot be empty
- Instagram note content cannot be empty.
- prompt cannot be empty
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/5cf0865c79626d6c.
Report an issue: GitHub.