{"record":{"id":"a2ffd331dc9cca87","repo":"jackwener/OpenCLI","slug":"config-a2ffd3","errorCode":"CONFIG","errorMessage":"Password required","messagePattern":"Password required","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/ones/login.js","lineNumber":39,"sourceCode":"            name: 'phone',\n            type: 'str',\n            required: false,\n            help: 'Account phone (or set ONES_PHONE); ignored if email is set',\n        },\n        {\n            name: 'password',\n            type: 'str',\n            required: false,\n            help: 'Password (or set ONES_PASSWORD)',\n        },\n    ],\n    columns: ['uuid', 'name', 'email', 'token_preview'],\n    func: async (page, kwargs) => {\n        const email = kwargs.email?.trim() || process.env.ONES_EMAIL?.trim();\n        const phone = kwargs.phone?.trim() || process.env.ONES_PHONE?.trim();\n        const password = kwargs.password || process.env.ONES_PASSWORD || '';\n        if (!password) {\n            throw new CliError('CONFIG', 'Password required', 'Pass --password or set ONES_PASSWORD for non-interactive use.');\n        }\n        if (!email && !phone) {\n            throw new CliError('CONFIG', 'email or phone required', 'Pass --email or --phone (or set ONES_EMAIL / ONES_PHONE).');\n        }\n        getOnesBaseUrl();\n        const bodyObj = { password };\n        if (email)\n            bodyObj.email = email;\n        else\n            bodyObj.phone = phone;\n        const parsed = (await onesFetchInPage(page, 'auth/login', {\n            method: 'POST',\n            body: JSON.stringify(bodyObj),\n            auth: false,\n        }));\n        const user = parsed.user;\n        if (!user?.uuid || !user?.token) {\n            throw new CliError('FETCH_ERROR', 'ONES login response missing user.uuid or user.token', 'Your server build may differ from documented Project API.');","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/ones/login.js#L21-L57","documentation":"The `opencli ones login` command performs a non-interactive password login against the ONES Project API. It resolves the password from --password or the ONES_PASSWORD env var; if empty it throws a CONFIG error, because there is no interactive prompt in this code path. This is a pre-flight input validation thrown before any network call.","triggerScenarios":"Running `opencli ones login --email you@corp.com` (or --phone) without --password and without ONES_PASSWORD set in the environment.","commonSituations":"Scripting login in CI where only email was exported; assuming the CLI will prompt interactively; ONES_PASSWORD defined under a different name or not exported in the current shell.","solutions":["Pass --password '<your-password>' on the command line.","Export ONES_PASSWORD in your shell or CI secrets before running the command.","If you cannot store the password, skip login and instead authenticate via the logged-in Chrome session plus ONES_USER_ID/ONES_AUTH_TOKEN headers."],"exampleFix":"// before\nopencli ones login --email me@corp.com\n// after\nONES_PASSWORD='...' opencli ones login --email me@corp.com","handlingStrategy":"validation","validationCode":"const password = process.env.ONES_PASSWORD;\nif (!password) {\n  throw new Error('ONES_PASSWORD must be set (or pass --password) before running `opencli ones login`.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await opencli.ones.login({ email, password });\n} catch (e) {\n  if (e.code === 'CONFIG' && e.message === 'Password required') {\n    console.error('Provide --password or export ONES_PASSWORD for non-interactive use.');\n  } else throw e;\n}","preventionTips":["Store ONES_PASSWORD in your CI secret manager, not in plaintext scripts.","In wrappers, check for the env var before invoking the CLI.","Remember this path is non-interactive — never rely on a prompt."],"tags":["config","cli","missing-argument","ones"],"backgroundTag":"missing-env-var","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}