jackwener/OpenCLI · error · ArgumentError

No fids provided

Error message

No fids provided

What it means

Thrown by clis/quark/rm.js when the required positional fids argument is present but yields an empty list after splitting on commas, trimming, and removing blanks/duplicates. The delete API call is skipped to avoid an empty filelist request. It is an ArgumentError.

Source

Thrown at clis/quark/rm.js:19

import { ArgumentError } from '@jackwener/opencli/errors';
import { cli, Strategy } from '@jackwener/opencli/registry';
import { DRIVE_API, apiPost } from './utils.js';
cli({
    site: 'quark',
    name: 'rm',
    access: 'write',
    description: 'Delete files from your Quark Drive',
    domain: 'pan.quark.cn',
    strategy: Strategy.COOKIE,
    defaultFormat: 'json',
    args: [
        { name: 'fids', required: true, positional: true, help: 'File IDs to delete (comma-separated)' },
    ],
    func: async (page, kwargs) => {
        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');
        await apiPost(page, `${DRIVE_API}/delete?pr=ucpro&fr=pc`, {
            filelist: fidList,
        });
        return { status: 'ok', count: fidList.length, deleted_fids: fidList };
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Supply at least one real fid: quark rm <fid> or quark rm fid1,fid2.
  2. Get valid fids first via a listing/search command, then pass them to rm.
  3. In scripts, verify the fid list is non-empty before calling rm.

Example fix

// before
quark rm "$FIDS"
// after
FIDS=$(echo "$FIDS" | tr -d '[:space:]')
[ -n "$FIDS" ] || { echo 'no fids to delete'; exit 1; }
quark rm "$FIDS"
Defensive patterns

Strategy: validation

Validate before calling

const fidList = String(rawFids || '')
  .split(',').map(s => s.trim()).filter(Boolean);
if (fidList.length === 0) throw new Error('rm requires at least one fid');

Type guard

function hasFids(v) {
  return typeof v === 'string' &&
    v.split(',').map(s => s.trim()).filter(Boolean).length > 0;
}

Prevention

When it happens

Trigger: Running rm with a value like ",,," or " , "; passing an empty string for the positional argument; a script feeding a variable that only contains separators after trimming.

Common situations: Generated fid lists that end up empty because an upstream step (search/list) returned nothing; shell variable holding only commas; misparsed output pasted as the fid argument.

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


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