{"record":{"id":"a3878b57498d4458","repo":"beekeeper-studio/beekeeper-studio","slug":"creating-database-on-remote-server-is-not-supporte","errorCode":null,"errorMessage":"Creating database on remote server is not supported","messagePattern":"Creating database on remote server is not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/studio/src-commercial/backend/lib/db/clients/libsql.ts","lineNumber":131,"sourceCode":"        : undefined,\n    });\n  }\n\n  protected createCursor(\n    ...args: ConstructorParameters<typeof SqliteCursor>\n  ): LibSQLCursor {\n    const options: LibSQLCursorOptions = {\n      isRemote: this.isRemote,\n      authToken: this.useAuthToken ? this.libsqlOptions.authToken : undefined,\n    };\n    args[4] = options;\n    // @ts-expect-error not fully typed\n    return new LibSQLCursor(...args);\n  }\n\n  protected _createDatabase(path: string) {\n    if (this.isRemote) {\n      throw new Error(\"Creating database on remote server is not supported\");\n    }\n    const conn = new Database(path);\n    conn.close();\n  }\n\n  private get useAuthToken(): boolean {\n    return this.libsqlOptions.mode === \"url\" && !!this.libsqlOptions.authToken;\n  }\n\n  private get libsqlOptions() {\n    return this.server.config.libsqlOptions;\n  }\n}\n","sourceCodeStart":113,"sourceCodeEnd":145,"githubUrl":"https://github.com/beekeeper-studio/beekeeper-studio/blob/4e3e03e3223b2b71a1af8926d455f533b80af837/apps/studio/src-commercial/backend/lib/db/clients/libsql.ts#L113-L145","documentation":"_createDatabase in the libsql client throws 'Creating database on remote server is not supported' when isRemote is true. Creating a database means creating a new local SQLite/libsql file via new Database(path); remote servers (http/https/ws endpoints) cannot have files created this way, so the operation is rejected.","triggerScenarios":"Calling _createDatabase (or the create-database flow that routes through it) while the client is connected to a remote libsql endpoint (isRemote true, e.g. https://xxx.turso.io).","commonSituations":"User tries 'create database' against a Turso/libsql server URL; app-level code creates a database as part of a setup flow without checking whether the target is remote.","solutions":["Create the remote database via the provider's CLI/API (e.g. turso db create), then connect to it","Check client.isRemote before attempting createDatabase and surface a clear message","For local-only flows, supply a file path instead of a remote URL"],"exampleFix":"// before\nawait client.createDatabase('https://my.turso.io/db');\n// after\nif (client.isRemote) {\n  // run: turso db create mydb, then connect\n} else {\n  await client.createDatabase('/path/new.db');\n}","handlingStrategy":"validation","validationCode":"if (client.isRemote) {\n  // route to provider CLI/API instead: turso db create <name>\n} else {\n  await client.createDatabase(localFilePath);\n}","typeGuard":"function isLocalLibsqlTarget(path: string): boolean {\n  return !/^:memory:$|libsql:|^http:|^https:|^ws:|^wss:/.test(path);\n}","tryCatchPattern":"try {\n  await client.createDatabase(path);\n} catch (e) {\n  if (e.message.includes('Creating database on remote server')) {\n    notifyUser('Create the database via your provider CLI (e.g. turso db create), then connect');\n  } else throw e;\n}","preventionTips":["Check isRemote before any create-database flow","Provision remote libsql/Turso databases with the provider's CLI or API, not the SQL client","Only offer the create-database action for local file targets in the UI"],"tags":["libsql","remote","unsupported-operation"],"backgroundTag":"remote-database-creation-unsupported","analyzedSha":"4e3e03e3223b2b71a1af8926d455f533b80af837","analyzedAt":"2026-08-31T23:21:23.379Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}