{"record":{"id":"96356db49166949b","repo":"cube-js/cube","slug":"something-wrong-with-downloading-cube-store-before","errorCode":null,"errorMessage":"Something wrong with downloading Cube Store before running it.","messagePattern":"Something wrong with downloading Cube Store before running it\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust/cubestore/js-wrapper/src/process.ts","lineNumber":128,"sourceCode":"\n  // Promise that works as mutex, but can be rejected\n  protected cubeStoreStarting: Promise<ChildProcess> | null = null;\n\n  // Flag when release was requested, in this state, we skip restart on exit\n  protected releaseRequested: boolean = false;\n\n  public constructor(\n    protected readonly config: Readonly<CubeStoreHandlerOptions>\n  ) {}\n\n  protected async getBinary() {\n    const pathToExecutable = getBinaryPath();\n\n    if (!fs.existsSync(pathToExecutable)) {\n      await downloadBinaryFromRelease();\n\n      if (!fs.existsSync(pathToExecutable)) {\n        throw new Error('Something wrong with downloading Cube Store before running it.');\n      }\n    }\n\n    return pathToExecutable;\n  }\n\n  public async acquire() {\n    if (this.cubeStore) {\n      return this.cubeStore;\n    }\n\n    if (this.cubeStoreStarting) {\n      return this.cubeStoreStarting;\n    }\n\n    const onExit = (code: number | null) => {\n      if (this.releaseRequested) {\n        return;","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/js-wrapper/src/process.ts#L110-L146","documentation":"Thrown by CubeStoreHandler.getBinary after attempting an automatic download of the Cube Store binary: even though downloadBinaryFromRelease() resolved, the expected executable at <cubestore>/downloaded/latest/bin/cubestored[.exe] still does not exist on disk. It is a sanity check indicating the download-or-extract step silently failed to produce the binary (or wrote it elsewhere).","triggerScenarios":"acquire() -> getBinary(): fs.existsSync(getBinaryPath()) is false, downloadBinaryFromRelease() completes without throwing (e.g. download reported OK but extraction produced nothing, or a partially-failed download left no executable), and the post-download fs.existsSync check still fails.","commonSituations":"Antivirus/endpoint security quarantining cubestored.exe right after extraction; corrupted or interrupted tar.gz extraction into the download dir; disk-permission issues preventing write into the package's downloaded/ folder (read-only node_modules, CI caches); running in a container where the previous failed run left an empty downloaded/latest directory that confuses path resolution; network middleboxes returning HTML error pages that pass non-404 checks.","solutions":["Delete the stale downloaded directory (node_modules/@cubejs-backend/cubestool/downloaded or rust/cubestore/downloaded) and re-run install/start to force a clean re-download.","Check filesystem permissions on the package directory; reinstall with a writable node_modules (avoid sudo/local permission mismatches; fix npm/yarn cache ownership).","Disable/whitelist antivirus interception of cubestored and re-download.","Check disk space and network/proxy settings; retry the install.","As a workaround, build cubestored from source and place it at <package>/downloaded/latest/bin/cubestored, or run Cube Store separately via Docker instead of the auto-download path."],"exampleFix":"// before\nrm -rf node_modules && yarn install   # may reuse a corrupt cache entry\n// after\ncd node_modules/@cubejs-backend/cubestool\nrm -rf downloaded/latest\nls -la downloaded/latest/bin/cubestored  # verify binary exists after re-download","handlingStrategy":"fallback","validationCode":"import fs from 'fs';\nimport { getBinaryPath } from '@cubejs-backend/cubestool/dist/process';\nif (!fs.existsSync(getBinaryPath())) {\n  console.warn('cubestored missing; will trigger download — ensure writable node_modules and no AV interference.');\n}","typeGuard":"function binaryExists(path: string): path is string {\n  return fs.existsSync(path) && fs.statSync(path).size > 0;\n}","tryCatchPattern":"try {\n  await cubeStoreHandler.acquire();\n} catch (e) {\n  if (/Something wrong with downloading Cube Store/.test(String(e))) {\n    await rmrf(path.join(cubestoolDir, 'downloaded', 'latest'));\n    await cubeStoreHandler.acquire(); // clean re-download\n  } else { throw e; }\n}","preventionTips":["Delete the downloaded/ directory after failed installs before retrying","Whitelist cubestored in antivirus/EDR so it is not quarantined post-extraction","Ensure node_modules is writable and has sufficient disk space","Prefer provisioning Cube Store via Docker in CI/containers instead of relying on auto-download","Re-download cleanly rather than reusing partially extracted caches"],"tags":["filesystem","binary-download","postcondition","cubestore"],"backgroundTag":"binary-download-incomplete","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}