:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(scenes): swallow keyed-logic build errors in activeSceneLogic (#56747)
posthog[bot]ce2544cd000b
diff --git a/frontend/src/scenes/sceneLogic.tsx b/frontend/src/scenes/sceneLogic.tsxindex 75adf94d23ff..afdd76a6afb4 100644--- a/frontend/src/scenes/sceneLogic.tsx+++ b/frontend/src/scenes/sceneLogic.tsx@@ -808,7 +808,21 @@ export const sceneLogic = kea<sceneLogicType>([(s) => [s.activeExportedScene, s.activeSceneLogicPropsWithTabId],(activeExportedScene, activeSceneLogicPropsWithTabId): BuiltLogic | null => {if (activeExportedScene?.logic) {- return activeExportedScene.logic.build(activeSceneLogicPropsWithTabId)+ try {+ return activeExportedScene.logic.build(activeSceneLogicPropsWithTabId)+ } catch (e) {+ // Building a keyed logic with undefined key (e.g. during a scene+ // transition before paramsToProps has resolved) throws+ // "Undefined key for logic". Swallow only that case so the scene+ // doesn't hard-crash; the next render with resolved params will+ // rebuild. Re-throw anything else so genuine build bugs (wrong+ // prop shape, missing reducer, etc.) still surface loudly.+ if (e instanceof Error && e.message.includes('Undefined key for logic')) {+ posthog.captureException(e, { source: 'sceneLogic.activeSceneLogic' })+ return null+ }+ throw e+ }}return null