Start with a missing expected file
Use explain when a preview or bundle is missing a file and you want the reason, rather than trying unrelated flags. It reports Content and Tree decisions for each requested path and does not create a bundle. Start with this independent fixture:
In a new folder named demo, create the following files with a text editor. The text after each filename is its content; use a line break for each ↵. Use sample values only. Open a terminal in demo. Do not reuse a folder containing an existing .onesourcerc.
README.md: # Demosrc/main.rs: fn main() {}.gitignore: notes.txtnotes.txt: Local notes.env: EXAMPLE_KEY=demo-only
OneSource must already be available as onesource. If it is not, follow Installation. All commands on this page start in this folder unless a step explicitly says otherwise.
1. Ask about the exact path and settings
Preview a note that .gitignore hides:
onesource --no-config -i "notes.txt" --dry-runExpect zero processed files. Diagnose with the same include and no-config settings; place the target after explain:
onesource explain notes.txt --no-config -i "notes.txt"════════════════════════════════════════
Path 1/1: notes.txt
Content:
Result: blocked by ignore filters
Tree:
Result: blocked by ignore filters
════════════════════════════════════════Content answers whether text would be attached. Tree answers whether the path is selected for the map. Both are blocked here. There is no Rule line for ignore because this diagnostic reports the ignore layer, not the exact .gitignore line.
For another root, put it before explain; relative targets are interpreted inside that root:
onesource /path/to/project explain src/main.rs --no-configReplace the example root with an actual folder. Multiple targets can be listed after explain; use the same active profile/options as the run you are investigating. For a saved review profile, use onesource explain src/main.rs -p review, provided that profile exists.
2. Change the relevant rule, then preview again
The reported reason is ignore, so changing include or tree-include will not solve it. If the note should normally remain ignored, bypass ignore only for this intentional selection:
onesource explain notes.txt --no-config -i "notes.txt" --no-ignoreExpect included for both sections. Now verify the entire selection, not just one path:
onesource --no-config -i "notes.txt" --no-ignore --dry-runExpect notes.txt and Files Processed: 1. If the note should be included in every normal run instead, deliberately change your ignore rule and rerun the original preview. explain does not edit ignore files or configuration.
3. Read a matching Rule and separate tree from content
A file can be intentionally visible in the map without its text being attached. Ask about README with different content/tree includes:
onesource explain README.md --no-config -i "*.rs" --ti "*.md"════════════════════════════════════════
Path 1/1: README.md
Content:
Result: not included by include
Rule: include = *.rs
Tree:
Result: included
════════════════════════════════════════The Rule tells you which include failed: *.rs does not match README.md. To attach README as well, replace the content include with a comma union:
onesource explain README.md --no-config -i "*.rs,README.md" --ti "*.md"Expect included in both sections. Then validate and write:
onesource --no-config -i "*.rs,README.md" --ti "*.md" --dry-runExpect README and main.rs as content, while the tree shows README only. To attach all content paths to the map too, remove the separate --ti override. For blacklist, use onesource explain .env --no-config: Rule identifies .env, so include cannot restore it. Keep real secrets excluded.
What each result means and what to do next
Read the result before changing flags. The table maps every diagnostic string to a cause and an appropriate next check. A blocked result is still a successful diagnosis; it is not necessarily an execution error.
| Result | Cause and next action |
|---|---|
included | The path passes this section’s checks; verify the whole selection with dry-run. |
included with lossy UTF-8 replacement characters | Non-UTF-8 text was converted; inspect replacement characters or convert the source to UTF-8 first. |
not found | Check spelling and root-relative location, then create or select an existing path. |
outside the scan root | The resolved target is outside root; select an appropriate root or keep external content excluded. |
excluded because it is the current output file | The path is the active -o/default output; choose another output if this is intentionally an input file. |
not a content file (directory or special path) | Directories do not have attached text; diagnose the file inside instead. Do not try to bundle devices or pipes. |
disabled by --no-tree | Tree is disabled; use --no-tree=false if you want the map restored. |
blocked by blacklist | Read Rule to identify the built-in entry. Keep secrets out; bypass only for deliberately reviewed inputs. |
blocked by ignore filters | Inspect project/parent ignore rules, or use --no-ignore for a deliberate one-off. |
blocked by exclude | Remove or narrow the reported exclude. Adding include cannot beat exclude. |
not included by include | Broaden the reported include, add a comma pattern, or clear it with an empty string. |
skipped by max-size | Compare Rule actual bytes with the KiB limit; raise -m only if the content budget permits. |
skipped because binary file | A NUL byte was found. Omit binary content or export text from its original tool. |
skipped because unreadable | Read Rule’s metadata/read error; check access rights, file existence and broken links, then retry. |
Accepted options and diagnostic limits
One or more paths are required; relative paths resolve against the scan root, absolute paths are allowed. Root is the top-level PATH before explain. After explain, all profile options plus -p/--profile, --no-config and compatibility flags --dry-run, --save, --replace, -c/--copy, --show-arg are accepted. Options after explain override top-level options. --desc and the compatibility action flags do not save, replace, copy, generate a bundle or print resolved arguments; explain returns before normal execution. It may read and inspect files.
explain inspects the current filesystem; it can read content and traverse ignore rules. Missing paths have a Content result only. Resolve/permission errors can stop the diagnostic. Symlink canonicalization and ignore traversal may differ from a full scan, and files can change between runs; use dry-run as your final selection check. Diagnostics accept action flags for compatibility, but explain --save --copy --replace performs none of those actions.