jdx/mise · error
contains ` ` but no ` ` after it, --inject requires both…
Error message
{} contains `{TASK_PLACEHOLDER_START}` but no `{TASK_PLACEHOLDER_END}` after it, --inject requires both markers What it means
mise's `mise generate task-docs --inject` updates documentation between TASK_PLACEHOLDER_START and TASK_PLACEHOLDER_END markers in a docs file. This error means the file contains the opening marker but the closing marker is missing, so the injection range cannot be computed and mise refuses to modify the file rather than guessing where the docs section ends.
Solutions
- Open the file passed via --inject and re-add the TASK_PLACEHOLDER_END marker after the start marker
- If the markers are unwanted, remove TASK_PLACEHOLDER_START too and stop using --inject for that file (generate docs to a separate path instead)
- Regenerate the docs file from a template that contains both markers
Example fix
// before (broken file) <!-- TASK_PLACEHOLDER_START --> ...docs... // after <!-- TASK_PLACEHOLDER_START --> ...docs... <!-- TASK_PLACEHOLDER_END -->
Defensive patterns
Strategy: validation
Validate before calling
const c = fs.readFileSync(injectPath, 'utf8');
if (c.includes('TASK_PLACEHOLDER_START') && !c.includes('TASK_PLACEHOLDER_END')) {
throw new Error(`${injectPath} has start marker but no end marker; fix before running mise generate task-docs --inject`);
} Type guard
const hasBothMarkers = (s: string) =>
s.includes('TASK_PLACEHOLDER_START') && s.includes('TASK_PLACEHOLDER_END'); Prevention
- Never delete only one of the two placeholder markers when editing generated docs
- Check both markers survive merge conflict resolution in docs files
- Keep docs templates with both markers version-controlled
- Run a pre-commit check that pairs start/end markers in injected docs files
When it happens
Trigger: Running `mise generate task-docs --inject` against a file where a hand edit, partial delete, or merge conflict removed the TASK_PLACEHOLDER_END line while leaving TASK_PLACEHOLDER_START in place.
Common situations: Developers cleaning up generated docs and deleting only the closing marker comment; merge conflicts where one side dropped the end marker; initial setup where the template file was copied without the closing marker.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- does not contain the ` ` marker required by --inject, add
- idiomatic version files markers are reversed
- a branch name is required
- a glob is required
- a repository preview directory requires a dry run
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/1b0b7653f72869aa.
Report an issue: GitHub.
Appendix: source
Thrown at src/cli/generate/task_docs.rs:155
/// Replace everything between the mise-tasks markers in `contents` with `doc`.
///
/// Both markers must be present, with the end marker after the start marker. When
/// a marker is missing this errors instead of writing anything: falling back to
/// "the block starts at byte 0" truncated files that had no markers at all, and
/// panicked outright on files shorter than the marker (discussions/4676).
fn inject_task_docs(contents: &str, doc: &str, output: &Path) -> eyre::Result<String> {
let Some(start) = contents.find(TASK_PLACEHOLDER_START) else {
bail!(
"{} does not contain the `{TASK_PLACEHOLDER_START}` marker required by --inject, add:\n\n{TASK_PLACEHOLDER_START}\n{TASK_PLACEHOLDER_END}",
file::display_path(output)
);
};
let body_start = start + TASK_PLACEHOLDER_START.len();
let Some(end) = contents[body_start..]
.find(TASK_PLACEHOLDER_END)
.map(|e| e + body_start)
else {
bail!(
"{} contains `{TASK_PLACEHOLDER_START}` but no `{TASK_PLACEHOLDER_END}` after it, --inject requires both markers",
file::display_path(output)
);
};
let mut contents = contents.to_string();
contents.replace_range(body_start..end, doc);
Ok(contents)
}
#[cfg(test)]
mod tests {
use super::{TASK_PLACEHOLDER_END, TASK_PLACEHOLDER_START, inject_task_docs};
use std::path::Path;
fn inject(contents: &str) -> eyre::Result<String> {
inject_task_docs(contents, "\n## `task`\n", Path::new("README.md"))
}
View on GitHub (pinned to 533346cc37)