different-ai/openwork · error

app.unknown_error

app.unknown_error

Error message

t("app.unknown_error")

What it means

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.

Source

Thrown at apps/app/src/react-app/domains/settings/pages/environment-view.tsx:153

  });

  const readEnvironmentValue = async (item: EnvItem) => {
    if (typeof item.value === "string") return item.value;
    if (!item.hasValue) {
      queryClient.setQueryData<{ items: EnvItem[] }>(
        environmentUserEnvQueryKey(props.runtimeKey),
        (current) => {
          if (!current) return current;
          return {
            items: current.items.map((entry) =>
              entry.key === item.key ? { ...entry, value: "" } : entry,
            ),
          };
        },
      );
      return "";
    }
    if (!props.client) throw new Error(t("app.unknown_error"));

    const response = await props.client.getUserEnv(item.key);
    queryClient.setQueryData<{ items: EnvItem[] }>(
      environmentUserEnvQueryKey(props.runtimeKey),
      (current) => {
        if (!current) return current;
        return {
          items: current.items.map((entry) =>
            entry.key === item.key
              ? {
                  ...entry,
                  value: response.item.value,
                  hasValue: response.item.hasValue,
                  updatedAt: response.item.updatedAt,
                }
              : entry,
          ),
        };

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Reconnect to the server or restart the app, then open the editor again
  2. Disable the edit action until a client connection exists
  3. Verify server health if client remains null

Example fix

// before
const value = await readEnvironmentValue(item);
// after
if (props.client) await readEnvironmentValue(item);
Defensive patterns

Strategy: type-guard

Validate before calling

if (!props.client) {
  showToast(t("app.unknown_error"));
  return;
}
await openEdit(item);

Type guard

const hasClient = (c: typeof props.client): c is NonNullable<typeof props.client> => c != null;

Try / catch

try {
  const value = await readEnvironmentValue(item);
  openDialog(value);
} catch (e) {
  if ((e as Error).message.includes("unknown_error")) promptReconnect();
  else throw e;
}

Prevention

When it happens

Trigger: Clicking edit on an environment variable (openEdit) when the app has no active client — server down, app still booting, or workspace without client binding.

Common situations: Editing env vars while disconnected from the local/remote server; race between page load and connection establishment.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/409956ba8ac6b1bc. Report an issue: GitHub.