{"record":{"id":"409956ba8ac6b1bc","repo":"different-ai/openwork","slug":"app-unknown-error-409956","errorCode":"app.unknown_error","errorMessage":"t(\"app.unknown_error\")","messagePattern":"t\\(\"app\\.unknown_error\"\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/domains/settings/pages/environment-view.tsx","lineNumber":153,"sourceCode":"  });\n\n  const readEnvironmentValue = async (item: EnvItem) => {\n    if (typeof item.value === \"string\") return item.value;\n    if (!item.hasValue) {\n      queryClient.setQueryData<{ items: EnvItem[] }>(\n        environmentUserEnvQueryKey(props.runtimeKey),\n        (current) => {\n          if (!current) return current;\n          return {\n            items: current.items.map((entry) =>\n              entry.key === item.key ? { ...entry, value: \"\" } : entry,\n            ),\n          };\n        },\n      );\n      return \"\";\n    }\n    if (!props.client) throw new Error(t(\"app.unknown_error\"));\n\n    const response = await props.client.getUserEnv(item.key);\n    queryClient.setQueryData<{ items: EnvItem[] }>(\n      environmentUserEnvQueryKey(props.runtimeKey),\n      (current) => {\n        if (!current) return current;\n        return {\n          items: current.items.map((entry) =>\n            entry.key === item.key\n              ? {\n                  ...entry,\n                  value: response.item.value,\n                  hasValue: response.item.hasValue,\n                  updatedAt: response.item.updatedAt,\n                }\n              : entry,\n          ),\n        };","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/domains/settings/pages/environment-view.tsx#L135-L171","documentation":"readEnvironmentValue in environment-view reads an env var's current value via client.getUserEnv before opening the edit dialog. If props.client is null it throws the localized \"app.unknown_error\" so the value cannot be fetched on a disconnected runtime.","triggerScenarios":"Clicking edit on an environment variable (openEdit) when the app has no active client — server down, app still booting, or workspace without client binding.","commonSituations":"Editing env vars while disconnected from the local/remote server; race between page load and connection establishment.","solutions":["Reconnect to the server or restart the app, then open the editor again","Disable the edit action until a client connection exists","Verify server health if client remains null"],"exampleFix":"// before\nconst value = await readEnvironmentValue(item);\n// after\nif (props.client) await readEnvironmentValue(item);","handlingStrategy":"type-guard","validationCode":"if (!props.client) {\n  showToast(t(\"app.unknown_error\"));\n  return;\n}\nawait openEdit(item);","typeGuard":"const hasClient = (c: typeof props.client): c is NonNullable<typeof props.client> => c != null;","tryCatchPattern":"try {\n  const value = await readEnvironmentValue(item);\n  openDialog(value);\n} catch (e) {\n  if ((e as Error).message.includes(\"unknown_error\")) promptReconnect();\n  else throw e;\n}","preventionTips":["Render edit controls only when a client exists","Await connection-ready state before enabling the env view","Reset dialogs on disconnect"],"tags":["null-client","environment-variables"],"backgroundTag":"null-client-uninitialized","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}