jackwener/OpenCLI · error · Error

workspace/create failed: ret=${resp.ret} errmsg=${resp.errms

Error message

workspace/create failed: ret=${resp.ret} errmsg=${resp.errmsg || ''}

What it means

This error is thrown by the jimeng `new` CLI command when the POST to /mweb/v1/workspace/create returns an API-level failure: the `ret` code is anything other than 0 ('0' or 0). The Jimeng web API wraps results in a {ret, errmsg, data} envelope, so a non-zero `ret` means the server rejected the workspace-creation request. The error surfaces the raw `ret` code and `errmsg` verbatim so you can diagnose the exact server-side rejection.

Source

Thrown at clis/jimeng/new.js:25

    domain: 'jimeng.jianying.com',
    strategy: Strategy.COOKIE,
    browser: true,
    columns: ['workspace_id', 'workspace_url'],
    pipeline: [
        { navigate: 'https://jimeng.jianying.com/ai-tool/generate?type=image&workspace=0' },
        { evaluate: `(async () => {
  const resp = await fetch('/mweb/v1/workspace/create?aid=513695', {
    method: 'POST',
    credentials: 'include',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({})
  }).then(r => r.json());

  if (resp.ret === '1014' || resp.ret === 1014) {
    throw new Error('Not logged in — open jimeng.jianying.com in Chrome and sign in first');
  }
  if (resp.ret !== '0' && resp.ret !== 0) {
    throw new Error('workspace/create failed: ret=' + resp.ret + ' errmsg=' + (resp.errmsg || ''));
  }

  const wsId = resp.data?.workspace_id;
  if (!wsId) {
    throw new Error('workspace/create returned no workspace_id: ' + JSON.stringify(resp).substring(0, 200));
  }

  return [{
    workspace_id: String(wsId),
    workspace_url: 'https://jimeng.jianying.com/ai-tool/generate?type=image&workspace=' + wsId,
  }];
})()
` },
        { map: {
                workspace_id: '${{ item.workspace_id }}',
                workspace_url: '${{ item.workspace_url }}',
            } },
    ],

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the `ret` and `errmsg` in the message and look up that specific code in Jimeng's API; fix the underlying cause it describes.
  2. Re-check that you are properly signed in to jimeng.jianying.com in Chrome (ret 1014 is the explicit 'not logged in' code; other codes may still be session-related) and retry.
  3. Wait and retry if the message suggests throttling/frequency limits.
  4. Update the CLI: if Jimeng changed the create payload, the embedded evaluate script may need new headers/body fields.
  5. Inspect the raw response manually in Chrome DevTools from the site to compare a working request with the CLI's request.

Example fix

// If Jimeng started requiring a payload field:
// before
body: JSON.stringify({})
// after
body: JSON.stringify({ app_id: 513695, scene: 1 })
Defensive patterns

Strategy: try-catch

Validate before calling

// Check session before running:
// 1. Confirm signed in: open jimeng.jianying.com in Chrome.
// 2. Confirm cookie presence before invoking the CLI.

Type guard

function isOkEnvelope(resp) {
  return resp && (resp.ret === '0' || resp.ret === 0) && resp.data?.workspace_id;
}

Try / catch

try {
  await run(['jimeng', 'new']);
} catch (e) {
  if (String(e.message).startsWith('workspace/create failed:')) {
    const m = e.message.match(/ret=(\S+) errmsg=(.*)/);
    console.error(`Jimeng rejected create (ret=${m?.[1]}): ${m?.[2]}`);
    // handle per ret code: throttle -> retry with backoff, contract change -> update CLI
  } else throw e;
}

Prevention

When it happens

Trigger: Running `jimeng new` where the browser-context fetch to /mweb/v1/workspace/create?aid=513695 responds with {ret: <non-zero>}. Note the specific ret 1014 is handled earlier as a login error, so this error means some other code: rate limiting, CSRF/timestamp mismatch, region restrictions, or API contract changes.

Common situations: Jimeng changed its workspace/create API (new required fields or error codes); requests throttled after repeated runs; a stale or partially-valid session cookie passes the 1014 check but fails authorization; network proxy or region block returning an error envelope.

Related errors


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