jackwener/OpenCLI · error · CliError

CONFIG

CONFIG

Error message

team UUID required

What it means

The `opencli ones my-tasks` command requires a team UUID to scope the filters/peek query. It resolves it from --team, ONES_TEAM_UUID, or ONES_TEAM_ID; if all are empty it throws CONFIG before any network activity. The team uuid appears in ONES web URLs as …/team/<team>/….

Source

Thrown at clis/ones/my-tasks.js:76

            type: 'int',
            default: 100,
            help: 'Max rows (default 100, max 500)',
        },
        {
            name: 'mode',
            type: 'str',
            default: 'assign',
            choices: ['assign', 'field004', 'owner', 'both'],
            help: 'assign=负责人(顶层 assign);field004=负责人(筛选器示例里的 field004);owner=创建者;both=负责人∪创建者(两次 peek 去重)',
        },
    ],
    columns: ['title', 'status', 'project', 'uuid', 'updated', '工时'],
    func: async (page, kwargs) => {
        const team = kwargs.team?.trim() ||
            process.env.ONES_TEAM_UUID?.trim() ||
            process.env.ONES_TEAM_ID?.trim();
        if (!team) {
            throw new CliError('CONFIG', 'team UUID required', 'Pass team from URL …/team/<team>/… or set ONES_TEAM_UUID.');
        }
        const limit = parsePeekLimit(kwargs.limit, 100);
        const mode = String(kwargs.mode ?? 'assign');
        await gotoOnesHome(page);
        const userUuid = await resolveOnesUserUuid(page, { skipGoto: true });
        let entries = [];
        if (mode === 'both') {
            const cap = Math.min(500, limit * 2);
            const asAssign = await peekTasks(page, team, queryAssign(userUuid), cap);
            const asOwner = await peekTasks(page, team, queryOwner(userUuid), cap);
            entries = dedupeByUuid([...asAssign, ...asOwner]).slice(0, limit);
        }
        else {
            const queryByMode = () => {
                switch (mode) {
                    case 'field004':
                        return queryAssignField004(userUuid);
                    case 'owner':

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass --team <teamUUID>, copying the segment from your ONES URL …/team/<team>/….
  2. Export ONES_TEAM_UUID in your shell profile so all ONES commands inherit it.
  3. Confirm the value is non-empty after trimming and is the team id, not the user uuid.

Example fix

// before
opencli ones my-tasks
// after
export ONES_TEAM_UUID='AbCd1234'
opencli ones my-tasks
Defensive patterns

Strategy: validation

Validate before calling

const team = process.env.ONES_TEAM_UUID?.trim() || process.env.ONES_TEAM_ID?.trim();
if (!team) {
  throw new Error('Set ONES_TEAM_UUID (from your ONES URL …/team/<team>/…) before running my-tasks commands.');
}

Try / catch

try {
  const rows = await opencli.ones.myTasks({});
} catch (e) {
  if (e.code === 'CONFIG' && e.message === 'team UUID required') {
    console.error('Pass --team <teamUUID> or export ONES_TEAM_UUID.');
  } else throw e;
}

Prevention

When it happens

Trigger: Running `opencli ones my-tasks` with no --team flag and neither ONES_TEAM_UUID nor ONES_TEAM_ID exported.

Common situations: First-time setup where only ONES_BASE_URL was configured; team uuid exported under a different variable name; whitespace-only value (trimmed to empty); forgetting that team uuid (a short id from the URL) differs from the user uuid.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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