Skip to content

fix(detection): stop reporting broken-symlink fs errors as exceptions#750

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/quiet-benign-fs-errors
Draft

fix(detection): stop reporting broken-symlink fs errors as exceptions#750
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/quiet-benign-fs-errors

Conversation

@posthog

@posthog posthog Bot commented Jun 27, 2026

Copy link
Copy Markdown

Problem

The wizard's error tracking was getting flooded with noise from broken symlinks it already handles fine. During warehouse-source detection, walkProjectFiles calls fs.statSync on every symlink to resolve its target. A broken symlink (e.g. a stale macOS ~/Library/Logs/ims.log link) makes statSync throw ENOENT. The code already catches this and skips the entry — but reportFsError then piped it into analytics.captureException, so every benign broken symlink became an error-tracking issue (39 occurrences across 3 users in ~4 hours). It's not a crash; the wizard flow is unaffected — it's pure triage noise, and it recurs for anyone whose tree contains a broken symlink (same for the sibling realpath/readdir catches on ENOENT/EACCES).

Changes

reportFsError now distinguishes expected, already-handled filesystem errors from genuine failures. Benign codes from best-effort traversal — ENOENT (broken symlink target gone), EACCES/EPERM (unreadable entry) — are downgraded to a debug log line instead of captureException. Any other code still surfaces as an exception. Traversal behavior is unchanged; only where the error is recorded changes.

Test plan

Added src/utils/__tests__/file-utils.test.ts covering a real broken symlink in a temp dir:

  • a broken symlink is skipped, the sibling real file is still visited, and nothing is reported to error tracking (logged instead)
  • an unexpected EIO readdir failure still calls captureException

pnpm build && pnpm test green; pnpm lint reports 0 errors.


Created with PostHog Code from an inbox report.

During best-effort project-tree traversal (`walkProjectFiles`), broken
symlinks (ENOENT) and unreadable entries (EACCES/EPERM) are already
caught and skipped, but `reportFsError` still piped them into
`analytics.captureException`, turning every benign symlink into an
error-tracking issue.

Downgrade expected filesystem error codes to a debug log line while
still capturing genuinely unexpected failures as exceptions.

Generated-By: PostHog Code
Task-Id: 2287642a-b5dc-4a9e-9f17-6dabae1215da
@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci error-tracking-upload-source-maps
  • /wizard-ci mcp-analytics
  • /wizard-ci misc
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci error-tracking-upload-source-maps/android
  • /wizard-ci error-tracking-upload-source-maps/cicd-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-nested-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-github-actions-single-stage-docker-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-gitlab-node-raw
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-pnpm-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-monorepo-raw-node-react
  • /wizard-ci error-tracking-upload-source-maps/cicd-ssh-vps-node-raw
  • /wizard-ci error-tracking-upload-source-maps/flutter
  • /wizard-ci error-tracking-upload-source-maps/ios
  • /wizard-ci error-tracking-upload-source-maps/next
  • /wizard-ci error-tracking-upload-source-maps/next-no-posthog
  • /wizard-ci error-tracking-upload-source-maps/node-raw
  • /wizard-ci error-tracking-upload-source-maps/node-rollup
  • /wizard-ci error-tracking-upload-source-maps/node-rollup-typescript-plugin
  • /wizard-ci error-tracking-upload-source-maps/node-webpack
  • /wizard-ci error-tracking-upload-source-maps/nuxt-3-6
  • /wizard-ci error-tracking-upload-source-maps/nuxt-4-3
  • /wizard-ci error-tracking-upload-source-maps/react-native
  • /wizard-ci error-tracking-upload-source-maps/react-vite
  • /wizard-ci error-tracking-upload-source-maps/rust
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci misc/quack-quack
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants