{"record":{"id":"5cf0865c79626d6c","repo":"jackwener/OpenCLI","slug":"no-fids-provided","errorCode":null,"errorMessage":"No fids provided","messagePattern":"No fids provided","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/quark/mv.js","lineNumber":24,"sourceCode":"    name: 'mv',\n    access: 'write',\n    description: 'Move files to a folder in your Quark Drive',\n    domain: 'pan.quark.cn',\n    strategy: Strategy.COOKIE,\n    defaultFormat: 'json',\n    args: [\n        { name: 'fids', required: true, positional: true, help: 'File IDs to move (comma-separated)' },\n        { name: 'to', default: '', help: 'Destination folder path (required unless --to-fid is set)' },\n        { name: 'to-fid', default: '', help: 'Destination folder ID (overrides --to)' },\n        { name: 'timeout', type: 'int', required: false, default: 120, help: 'Max seconds for the overall command (default: 120)' },\n    ],\n    func: async (page, kwargs) => {\n        const to = kwargs.to;\n        const toFid = kwargs['to-fid'];\n        const fids = kwargs.fids;\n        const fidList = [...new Set(fids.split(',').map(id => id.trim()).filter(Boolean))];\n        if (fidList.length === 0)\n            throw new ArgumentError('No fids provided');\n        if (!to && !toFid)\n            throw new ArgumentError('Either --to or --to-fid is required');\n        if (to && toFid)\n            throw new ArgumentError('Cannot use both --to and --to-fid');\n        const targetFid = toFid || await findFolder(page, to);\n        const data = await apiPost(page, `${DRIVE_API}/move?pr=ucpro&fr=pc`, {\n            filelist: fidList,\n            to_pdir_fid: targetFid,\n        });\n        const result = {\n            status: 'pending',\n            count: fidList.length,\n            destination: to || toFid,\n            task_id: data.task_id,\n            completed: false,\n        };\n        if (data.task_id) {\n            const completed = await pollTask(page, data.task_id);","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/quark/mv.js#L6-L42","documentation":"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.","triggerScenarios":"Running quark mv with --fids \"\", --fids \",,\" or --fids \" , \" so the filtered fid list is empty; the mv command aborts before contacting the API.","commonSituations":"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.","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."],"exampleFix":"// before\nconst fids = ids.join(','); // '' when ids is empty\nawait run(['quark', 'mv', '--fids', fids, '--to', '/docs']);\n// after\nif (ids.length === 0) throw new Error('nothing to move');\nconst fids = ids.join(',');\nawait run(['quark', 'mv', '--fids', fids, '--to', '/docs']);","handlingStrategy":"validation","validationCode":"const fidList = [...new Set(fids.split(',').map(s => s.trim()).filter(Boolean))];\nif (fidList.length === 0) throw new Error('Provide at least one fid in --fids');","typeGuard":"function hasFids(fidsArg) {\n  return typeof fidsArg === 'string' && fidsArg.split(',').some(s => s.trim() !== '');\n}","tryCatchPattern":"try {\n  await run(['quark', 'mv', '--fids', fids, '--to', dest]);\n} catch (e) {\n  if (/No fids provided/.test(String(e.message))) {\n    console.error('--fids was empty or whitespace-only; supply comma-separated file ids.');\n    process.exitCode = 2;\n  } else throw e;\n}","preventionTips":["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"],"tags":["argument-validation","quark","mv","cli","empty-input"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}