{"record":{"id":"f4893eb33a1226bb","repo":"paperclipai/paperclip","slug":"local-trusted-mode-requires-loopback-host-binding","errorCode":null,"errorMessage":"local_trusted mode requires loopback host binding (received: ${config.host}). Use authenticated mode for non-loopback deployments.","messagePattern":"local_trusted mode requires loopback host binding \\(received: (.+?)\\)\\. Use authenticated mode for non-loopback deployments\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/index.ts","lineNumber":623,"sourceCode":"    }\n  \n    const embeddedAdminConnectionString = `postgres://paperclip:paperclip@127.0.0.1:${port}/postgres`;\n    const dbStatus = await ensurePostgresDatabase(embeddedAdminConnectionString, \"paperclip\");\n    if (dbStatus === \"created\") {\n      logger.info(\"Created embedded PostgreSQL database: paperclip\");\n    }\n  \n    const embeddedConnectionString = `postgres://paperclip:paperclip@127.0.0.1:${port}/paperclip`;\n    const shouldAutoApplyFirstRunMigrations = !clusterAlreadyInitialized || dbStatus === \"created\";\n    if (shouldAutoApplyFirstRunMigrations) {\n      logger.info(\"Detected first-run embedded PostgreSQL setup; applying pending migrations automatically\");\n    }\n    migrationSummary = await ensureMigrations(embeddedConnectionString, \"Embedded PostgreSQL\", {\n      autoApply: shouldAutoApplyFirstRunMigrations,\n    });\n  \n    db = createDb(embeddedConnectionString);\n    pluginMigrationDb = db;\n    logger.info(\"Embedded PostgreSQL ready\");\n    activeDatabaseConnectionString = embeddedConnectionString;\n    resolvedEmbeddedPostgresPort = port;\n    startupDbInfo = { mode: \"embedded-postgres\", dataDir, port };\n  }\n\n  // Ends every pool this process opened. Used by the orderly shutdown path\n  // (after the application services, before the embedded provider stops) and\n  // by the fail-loud startup path, so no exit leaves pooled backends behind.\n  const closeDatabaseClients = async () => {\n    const clients = pluginMigrationDb === db ? [db] : [db, pluginMigrationDb];\n    await Promise.all(clients.map((client) => endDatabaseClient(client, 5)));\n  };\n  startupDatabase.close = closeDatabaseClients;\n  \n  // A claimed warm-pool stack may restart while its provider environment still\n  // names the pool host. Restore the signed, durable identity before Better\n  // Auth, routes, or child-runtime configuration capture any public URL.","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/index.ts#L605-L641","documentation":"Startup safety check in startServer: deploymentMode is local_trusted (no authentication) but config.host binds a non-loopback interface (e.g. 0.0.0.0 or a LAN IP). An unauthenticated local_trusted server on a public interface would expose full-control board access, so startup aborts and instructs switching to authenticated mode.","triggerScenarios":"Thrown at server/src/index.ts:519 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Bind to a loopback host (127.0.0.1 or ::1) when using local_trusted mode.","Switch to authenticated mode for non-loopback deployments."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}