different-ai/openwork · warning

URLs open in browser tabs.

Error message

URLs open in browser tabs.

What it means

The artifact panel's query function only loads workspace file artifacts; URL artifacts are not viewable in the panel and are meant to be opened in the browser. The queryFn intentionally throws this plain Error so React Query surfaces an error state instead of attempting to read a URL as a file.

Source

Thrown at apps/app/src/react-app/domains/session/artifacts/artifact-panel.tsx:128

  const workspaceName = workspaceRoot.split(/[/\\]/).filter(Boolean).pop() ?? "Workspace";

  const openWorkspaceFile = (entry: { path: string; size: number; mtimeMs: number }) => {
    const nextTarget = openTargetFromWorkspaceFile(entry.path, { size: entry.size, updatedAt: entry.mtimeMs });
    if (!nextTarget) return;
    usePanelTabStore.getState().openTab(sessionId, {
      id: nextTarget.id,
      type: "artifact",
      label: nextTarget.name,
      preview: nextTarget.preview,
      target: nextTarget,
    });
  };

  const { data, error, isError, isLoading } = useQuery<ArtifactQueryState>({
    queryKey: ["artifact-panel", workspaceId, target.id, target.updatedAt ?? null] as const,
    queryFn: async () => {
      if (target.kind === "url") {
        throw new Error("URLs open in browser tabs.");
      }
      else if (target.exists === false) {
        throw new Error("File not found in this workspace.");
      }

      if (isTextContent(target)) {
        const result = await client.readWorkspaceFile(workspaceId, target.value);

        return { kind: "text", data: result.content, updatedAt: result.updatedAt ?? null };
      }

      const result = await client.downloadWorkspaceFile(workspaceId, target.value);

      return { kind: "binary", data: result.data, contentType: result.contentType, updatedAt: target.updatedAt ?? null };
    },
    refetchOnReconnect: false,
    refetchOnWindowFocus: false,
    staleTime: Infinity,

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Open URL artifacts in a browser tab (window.open) instead of routing them to the artifact panel.
  2. Filter or disable URL artifacts upstream so the panel is only opened for file targets.
  3. Render a friendly 'open in browser' affordance for kind === "url" rather than letting the error state show.
  4. If this is unexpected, check the artifact target typing — target.kind should be "file" for panel viewing.

Example fix

// before
openArtifact(target); // panel handles all kinds
// after
if (target.kind === "url") window.open(target.value, "_blank");
else openArtifact(target);
Defensive patterns

Strategy: type-guard

Validate before calling

if (target.kind === "url") {
  window.open(target.value, "_blank");
  return;
}

Type guard

function isFileTarget(target: ArtifactTarget): target is ArtifactTarget & { kind: "file" } {
  return target.kind === "file";
}

Try / catch

const { data, isError, error } = useQuery({ queryKey: [...], queryFn });
if (isError) {
  if (error.message === "URLs open in browser tabs.") return <OpenInBrowserLink target={target} />;
  return <ErrorState message={error.message} />;
}

Prevention

When it happens

Trigger: ArtifactPanelView's useQuery queryFn is invoked with target.kind === "url" — i.e. the panel is asked to render an artifact whose target is a URL.

Common situations: Agent produced a URL artifact and the UI routed it to the artifact panel; user clicked an artifact entry of kind url; regression in artifact routing that no longer opens URLs in a browser tab.

Related errors


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