Skip to content

fix: actionable instructions when sandbox-binary directory is missing#114

Merged
renecannao merged 1 commit into
masterfrom
fix/unpack-error-message-instructions
May 14, 2026
Merged

fix: actionable instructions when sandbox-binary directory is missing#114
renecannao merged 1 commit into
masterfrom
fix/unpack-error-message-instructions

Conversation

@renecannao
Copy link
Copy Markdown

@renecannao renecannao commented May 13, 2026

Summary

  • Closes unpack should create default sandbox-binary directory if not exists #110.
  • When dbdeployer unpack fails because $HOME/opt/mysql (or a custom --sandbox-binary) doesn't exist, the error now tells the user exactly how to fix it instead of just saying "You should create it".
  • Points to dbdeployer init --skip-all-downloads (the canonical setup command) and includes a copy-pasteable mkdir -p <basedir> as a manual alternative.
  • No automatic side effects: directory is still not created on the user's behalf.

Before

directory '/Users/username/opt/mysql' not found
You should create it or provide an alternate base directory using --sandbox-binary

After

directory '/Users/username/opt/mysql' not found
Create it by running:
    dbdeployer init --skip-all-downloads
or manually with:
    mkdir -p /Users/username/opt/mysql
or provide an alternate base directory using --sandbox-binary

Test plan

  • go build ./... passes
  • go test ./cmd/... ./unpack/... passes
  • Manually verified with a clean HOME: error text matches the "After" block above and exit code is still 1

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error messaging when the sandbox binary directory is missing, now providing explicit guidance with multiple resolution options including initialization commands and directory creation methods.

Review Change Stack

…ssing

Closes #110. Previously `dbdeployer unpack` exited with only
"You should create it or provide an alternate base directory using --sandbox-binary",
leaving users to figure out the path and command themselves. The error now points
to `dbdeployer init --skip-all-downloads` (the canonical setup command) and
includes a ready-to-copy `mkdir -p <basedir>` as a manual alternative.

No behavior change beyond the error text: the directory is still not created
automatically.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

📝 Walkthrough

Walkthrough

The PR improves user experience by replacing a terse error message with detailed, multi-line guidance when the --sandbox-binary base directory does not exist. The new message includes concrete example commands to help users either create the directory or specify an alternate location.

Changes

Error Message Enhancement

Layer / File(s) Summary
Improved error guidance for missing sandbox-binary directory
cmd/unpack.go
Error message when the sandbox-binary directory is not found now includes multi-line instructions with example commands (dbdeployer init --skip-all-downloads, mkdir -p, or --sandbox-binary flag) instead of a single-line instruction.

🎯 1 (Trivial) | ⏱️ ~3 minutes

A message grows from one line thin,
With examples now showing the way,
Users need not puzzle or spin—
Just follow the guide, come what may! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: improving error messages with actionable instructions when the sandbox-binary directory is missing.
Linked Issues check ✅ Passed The PR addresses issue #110 by providing actionable error instructions (dbdeployer init, mkdir, or --sandbox-binary) without auto-creating the directory, meeting the stated objective.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to improving error messaging in cmd/unpack.go with no unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/unpack-error-message-instructions

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/unpack.go`:
- Line 74: The help text prints an unquoted mkdir command which breaks for
Basedir values with spaces or special chars; update the fmt.Sprintf call that
builds the help string (the line using fmt.Sprintf("    mkdir -p %s", Basedir)
in cmd/unpack.go) to produce a shell-safe path by quoting or escaping Basedir
(e.g., wrap it in single quotes or escape shell metacharacters) so the printed
command can be copy-pasted safely.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a56c7b8a-d935-47fe-8bae-184c09452743

📥 Commits

Reviewing files that changed from the base of the PR and between 857149f and c9ecece.

📒 Files selected for processing (1)
  • cmd/unpack.go

Comment thread cmd/unpack.go
"Create it by running:",
" dbdeployer init --skip-all-downloads",
"or manually with:",
fmt.Sprintf(" mkdir -p %s", Basedir),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Make the suggested mkdir command shell-safe.

The help text currently prints mkdir -p <path> without quoting, so copy-paste may fail when the base directory contains spaces/shell characters. Quote or escape Basedir in the displayed command.

Suggested fix
-           fmt.Sprintf("    mkdir -p %s", Basedir),
+           fmt.Sprintf("    mkdir -p %q", Basedir),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fmt.Sprintf(" mkdir -p %s", Basedir),
fmt.Sprintf(" mkdir -p %q", Basedir),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/unpack.go` at line 74, The help text prints an unquoted mkdir command
which breaks for Basedir values with spaces or special chars; update the
fmt.Sprintf call that builds the help string (the line using fmt.Sprintf("   
mkdir -p %s", Basedir) in cmd/unpack.go) to produce a shell-safe path by quoting
or escaping Basedir (e.g., wrap it in single quotes or escape shell
metacharacters) so the printed command can be copy-pasted safely.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the error message in cmd/unpack.go when the base directory is missing by providing specific commands for initialization and manual directory creation. Feedback was provided to wrap the directory path in double quotes within the suggested mkdir -p command to ensure it handles paths with spaces or special characters correctly.

Comment thread cmd/unpack.go
"Create it by running:",
" dbdeployer init --skip-all-downloads",
"or manually with:",
fmt.Sprintf(" mkdir -p %s", Basedir),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The suggested mkdir -p command may fail or behave unexpectedly if the Basedir path contains spaces or special characters. It is safer to wrap the path in double quotes to ensure the command is robust and copy-pasteable for all valid directory paths.

Suggested change
fmt.Sprintf(" mkdir -p %s", Basedir),
fmt.Sprintf(" mkdir -p \"%s\"", Basedir),

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.

unpack should create default sandbox-binary directory if not exists

1 participant