{"record":{"id":"845575af4662f455","repo":"cube-js/cube","slug":"provided-token-isn-t-for-dotcubecloud-url","errorCode":null,"errorMessage":"Provided token isn't for ${dotCubeCloud.url}","messagePattern":"Provided token isn't for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-cli/src/config.ts","lineNumber":29,"sourceCode":"\n    if (config.auth) {\n      return config.auth;\n    }\n\n    const auth = await inquirer.prompt([{\n      name: 'auth',\n      message: `Cube Cloud Auth Token${url ? ` for ${url}` : ''}`\n    }]);\n\n    return (await this.addAuthToken(auth.auth, config)).auth;\n  }\n\n  public async deployAuthForCurrentDir() {\n    const dotCubeCloud = await this.loadDotCubeCloud();\n    if (dotCubeCloud.url && dotCubeCloud.deploymentId) {\n      const deployAuth = await this.deployAuth(dotCubeCloud.url);\n      if (!deployAuth[dotCubeCloud.url]) {\n        throw new Error(`Provided token isn't for ${dotCubeCloud.url}`);\n      }\n\n      return {\n        ...deployAuth[dotCubeCloud.url],\n        url: dotCubeCloud.url,\n        deploymentId: dotCubeCloud.deploymentId\n      };\n    }\n\n    const auth = await this.deployAuth();\n    let url = Object.keys(auth)[0];\n    if (Object.keys(auth).length > 1) {\n      // eslint-disable-next-line prefer-destructuring\n      url = (await inquirer.prompt([{\n        type: 'list',\n        name: 'url',\n        message: 'Please select an organization',\n        choices: Object.keys(auth)","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-cli/src/config.ts#L11-L47","documentation":"CubeCloudConfig.deployAuthForCurrentDir validates that the locally stored Cube Cloud auth token actually belongs to the configured cloud URL. `deployAuth(url)` returns a map keyed by URLs the token is valid for; if the current `.cubecloud` file's url is not a key in that map, the token was issued for a different cloud deployment, so it throws.","triggerScenarios":"Running `cubejs deploy` (or any command calling cubeCloudClient) when the token in ~/.cubecloud or .cubecloud was created against a different Cube Cloud domain than dotCubeCloud.url, or the token was revoked/expired server-side so the URL mapping is missing.","commonSituations":"Working across multiple Cube Cloud instances/organizations; a colleague shared a .cubecloud file from another deployment; re-authenticating after SSO org change; stale token after the deployment URL changed.","solutions":["Re-authenticate with `cubejs login` (or the cloud token command) against the correct Cube Cloud URL so the token matches dotCubeCloud.url","Delete the stale .cubecloud file in the project directory and re-run deploy to reconfigure","Verify the url field in .cubecloud matches the cloud instance you are authenticated to","Confirm your Cube Cloud API token hasn't been revoked in the cloud UI settings"],"exampleFix":"// before (.cubecloud points to wrong instance)\n{ \"url\": \"https://cloud.other-org.cubecloud.dev\", \"deploymentId\": \"...\" }\n// after\n$ cubejs login\n{ \"url\": \"https://cloud.myorg.cubecloud.dev\", \"deploymentId\": \"...\" }","handlingStrategy":"validation","validationCode":"const cfg = JSON.parse(fs.readFileSync('.cubecloud', 'utf8'));\nconst deployAuth = JSON.parse(fs.readFileSync(path.join(os.homedir(), '.cubecloud'), 'utf8'));\nif (!deployAuth[cfg.url]) {\n  console.warn(`Token is not valid for ${cfg.url}; run 'cubejs login' first`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `cubejs login` against the same cloud URL as the project's .cubecloud","Don't share .cubecloud files between different cloud organizations","Re-login after token revocation or org changes"],"tags":["cli","authentication","cube-cloud"],"backgroundTag":"auth-token-mismatch","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}