{"record":{"id":"0e5d7abaf04067b2","repo":"jackwener/OpenCLI","slug":"not-logged-in-open-jimeng-jianying-com-in-chrome","errorCode":null,"errorMessage":"Not logged in — open jimeng.jianying.com in Chrome and sign in first","messagePattern":"Not logged in — open jimeng\\.jianying\\.com in Chrome and sign in first","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clis/jimeng/new.js","lineNumber":22,"sourceCode":"    name: 'new',\n    access: 'write',\n    description: '即梦AI 新建会话（workspace）',\n    domain: 'jimeng.jianying.com',\n    strategy: Strategy.COOKIE,\n    browser: true,\n    columns: ['workspace_id', 'workspace_url'],\n    pipeline: [\n        { navigate: 'https://jimeng.jianying.com/ai-tool/generate?type=image&workspace=0' },\n        { evaluate: `(async () => {\n  const resp = await fetch('/mweb/v1/workspace/create?aid=513695', {\n    method: 'POST',\n    credentials: 'include',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify({})\n  }).then(r => r.json());\n\n  if (resp.ret === '1014' || resp.ret === 1014) {\n    throw new Error('Not logged in — open jimeng.jianying.com in Chrome and sign in first');\n  }\n  if (resp.ret !== '0' && resp.ret !== 0) {\n    throw new Error('workspace/create failed: ret=' + resp.ret + ' errmsg=' + (resp.errmsg || ''));\n  }\n\n  const wsId = resp.data?.workspace_id;\n  if (!wsId) {\n    throw new Error('workspace/create returned no workspace_id: ' + JSON.stringify(resp).substring(0, 200));\n  }\n\n  return [{\n    workspace_id: String(wsId),\n    workspace_url: 'https://jimeng.jianying.com/ai-tool/generate?type=image&workspace=' + wsId,\n  }];\n})()\n` },\n        { map: {\n                workspace_id: '${{ item.workspace_id }}',","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jimeng/new.js#L4-L40","documentation":"new.js creates a Jimeng workspace via an in-page fetch with credentials:'include'. If the API responds with ret '1014' (Jimeng's not-logged-in code), the script throws a plain Error instructing the user to open jimeng.jianying.com in Chrome and sign in first. It guards against creating a workspace without a valid session.","triggerScenarios":"Running the jimeng new command when the attached Chrome profile has no valid Jimeng session: the workspace/create API returns ret 1014 (string or number), triggering this error before any workspace id is obtained.","commonSituations":"User forgot to log into Jimeng in the controlled browser; cookies expired or cleared; using the wrong Chrome profile; Jimeng session invalidated server-side; running headless/automation profile without login.","solutions":["Open https://jimeng.jianying.com/ in the attached Chrome and sign in, then rerun the command","Run the site's auth/login command first so the session is established before calling new","Verify the correct Chrome profile is attached (the one with Jimeng cookies)","Check cookies are not expired; re-login to refresh them","If logged in but still 1014, confirm the create API and ret codes are unchanged and cookies are being sent (credentials:'include')"],"exampleFix":"// before\nconst resp = await fetch(url, { method: 'POST', credentials: 'include', ... });\n// after\nconst resp = await fetch(url, { method: 'POST', credentials: 'include', ... });\nif (resp.ret === '1014' || resp.ret === 1014) {\n  throw new AuthRequiredError('jimeng.jianying.com', 'Not logged in — open jimeng.jianying.com in Chrome and sign in first');\n}","handlingStrategy":"validation","validationCode":"const probe = await page.evaluate(WHOAMI_PROBE);\nif (!probe?.ok) throw new Error('Sign in to jimeng.jianying.com before creating a workspace');","typeGuard":"function isNotLoggedInRet(ret) {\n  return ret === '1014' || ret === 1014;\n}","tryCatchPattern":"try {\n  await createWorkspace();\n} catch (err) {\n  if (/Not logged in/.test(err.message)) {\n    console.error('Open jimeng.jianying.com in the attached Chrome, sign in, then rerun.');\n    process.exitCode = 2; // distinct exit code for auth-required\n  } else throw err;\n}","preventionTips":["Run an auth/verify check before workspace-creating commands","Keep the attached Chrome profile logged in to Jimeng","Handle both string and number ret codes ('1014'/1014)","Re-login on session expiry rather than retrying blindly"],"tags":["auth","not-logged-in","jimeng","session-expired"],"backgroundTag":"auth-required-login","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}