claude-code - 💡(How to fix) Fix Claude used /bin/sh in cron for bash-syntax script — VNM Visual scraper silently broken for days [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48327Fetched 2026-04-16 07:02:52
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×3cross-referenced ×2commented ×1

Error Message

This is a trivially preventable error. Using bash -c '...' explicitly in the crontab entry is the correct approach. Claude knew the script used bash syntax. It should have written the cron with bash -c.

Root Cause

This is a trivially preventable error. Using bash -c '...' explicitly in the crontab entry is the correct approach. Claude knew the script used bash syntax. It should have written the cron with bash -c.

RAW_BUFFERClick to expand / collapse

Severity: HIGH — Silent production failure, data gap

Date discovered: 2026-04-06

What happened

Claude deployed a VNM Visual scraper cron job using /bin/sh syntax. The script used source .env — a bash-specific command that sh does not support.

When sh encountered source, it silently failed. The && chain broke. The Python script never ran. The log was never written to. The cron fired on schedule but did nothing.

The scraper had not written to its log since April 2 (4 days before discovery) despite cron running every 3 hours.

Impact

  • 4+ days of VNM visual price data missing
  • No alert fired (silent failure)
  • Required diagnosis during a separate audit session
  • Pattern: Claude deployed it, it appeared to work during manual test (because manual test used bash), but cron used sh

Why this matters

This is a trivially preventable error. Using bash -c '...' explicitly in the crontab entry is the correct approach. Claude knew the script used bash syntax. It should have written the cron with bash -c.

Requested resolution

  • Refund of credits
  • Fix: When writing cron entries for scripts that use bash-specific syntax, Claude must always use bash -c '...' explicitly — never rely on /bin/sh default

extent analysis

TL;DR

To prevent silent failures in cron jobs, use bash -c '...' explicitly when writing cron entries for scripts that contain bash-specific syntax.

Guidance

  • Verify the shell used by the cron daemon to ensure it supports the syntax used in the script.
  • Update the cron entry to use bash -c '...' to explicitly specify the shell, preventing reliance on the default /bin/sh.
  • Review existing cron jobs to identify any other scripts that may be using bash-specific syntax without explicit shell specification.
  • Consider adding logging or alerting mechanisms to detect and report silent failures in the future.

Example

# Incorrect cron entry
*/3 * * * * /path/to/script.sh

# Corrected cron entry
*/3 * * * * bash -c '/path/to/script.sh'

Notes

This solution assumes that the script is intended to be run with bash and that the cron daemon supports the use of bash -c. It's also important to note that this fix only addresses the specific issue described and may not prevent other types of silent failures.

Recommendation

Apply workaround: Use bash -c '...' explicitly in cron entries for scripts with bash-specific syntax to prevent silent failures. This approach ensures that the correct shell is used, even if the default shell is not bash.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING