denoland/deno · error
Failed ensuring public API type output is valid. {:#} You
Error message
Failed ensuring public API type output is valid.
{:#}
You may have discovered a bug in Deno. Please open an issue at: https://github.com/denoland/deno/issues/ What it means
As a final quality gate, publish type-checks the public API type output that fast-check generates for your package (unused-parameter diagnostics excluded, because stripped bodies drop them). If checking the generated output produces diagnostics, the `.d.ts`-equivalent Deno would upload is itself invalid — which the message interprets as a probable Deno bug and asks you to report.
Source
Thrown at cli/tools/publish/mod.rs:497
// fast check passed, type check the output as a temporary measure
// until we know that it's reliable and stable
let mut diagnostics_by_folder = self.type_checker.check_diagnostics(
graph,
CheckOptions {
build_fast_check_graph: false, // already built
lib: self.cli_options.ts_type_lib_window(),
reload: self.cli_options.reload_flag(),
type_check_mode: self.cli_options.type_check_mode(),
},
)?;
// ignore unused (type) parameter diagnostics that may occur due to fast
// check not having function body implementations
for result in diagnostics_by_folder.by_ref() {
let check_diagnostics = result?;
let check_diagnostics =
check_diagnostics.filter(|d| d.include_when_remote());
if check_diagnostics.has_diagnostic() {
bail!(
concat!(
"Failed ensuring public API type output is valid.\n\n",
"{:#}\n\n",
"You may have discovered a bug in Deno. Please open an issue at: ",
"https://github.com/denoland/deno/issues/"
),
check_diagnostics
);
}
}
Ok(diagnostics_by_folder.into_graph())
}
}
}
async fn prepare_publish(
&self,
package: &JsrPackageConfig,View on GitHub (pinned to f7822238ca)
Solutions
- Upgrade Deno (`deno upgrade`) or pin back to the previous version — fast-check regressions are typically fixed in a patch release.
- Adjust the exported constructs named in the attached diagnostics until the generated output type-checks.
- If it persists, open an issue at https://github.com/denoland/deno/issues including the diagnostics and a minimal reproduction.
Defensive patterns
Strategy: try-catch
Try / catch
#!/usr/bin/env bash
out="$(deno publish --dry-run 2>&1)" || {
if printf '%s' "$out" | grep -q 'You may have discovered a bug in Deno'; then
echo "Deno fast-check bug suspected — pin the previous Deno version and report upstream" >&2
exit 75 # dedicated code so pipelines can route it to an issue tracker
fi
printf '%s\n' "$out" >&2
exit 1
} Prevention
- Pin the Deno version in CI (`denoland/setup-deno` with a fixed version) so a new fast-check regression cannot break releases unattended.
- Keep exported entrypoints' TypeScript simple; re-test publishes with `--dry-run` when adopting complex exported types.
- Capture full diagnostics in CI logs — they are the required content of the upstream issue.
When it happens
Trigger: The post-fast-check `TypeChecker` run yields diagnostics with `include_when_remote()` — e.g. exported constructs (complex overloads, declaration merging, inference-heavy generics) that Deno's public-API stripping renders invalid. `--allow-slow-types` does not bypass this check.
Common situations: Publishing packages with advanced TypeScript in exported entrypoints right after a Deno upgrade changed fast-check behavior; regressions introduced by a new Deno version.
Related errors
- Type checking failed: {}
- When using DENO_INTERNAL_FAST_CHECK_OVERWRITE, the git repo
- Exiting due to DENO_INTERNAL_FAST_CHECK_OVERWRITE
- Cannot mock property '${String(methodName)}' because it is n
- ERR_TRACE_EVENTS_CATEGORY_REQUIRED
AI-assisted analysis of denoland/deno@f7822238ca (2026-08-20).
Data as JSON: /api/errors/dc6a6a87dc18f8b3.
Report an issue: GitHub.