diff --git a/doc/api/errors.md b/doc/api/errors.md
index fbe474d509f..f077e5b4b91 100644
--- a/doc/api/errors.md
+++ b/doc/api/errors.md
@@ -3329,7 +3329,8 @@ category.
### `ERR_TRACE_EVENTS_UNAVAILABLE`
The `node:trace_events` module could not be loaded because Node.js was compiled
-with the `--without-v8-platform` flag.
+with the `--without-v8-platform` flag, or because the process was initialized by
+an embedder that provides its own V8 platform.
diff --git a/lib/trace_events.js b/lib/trace_events.js
index b4b9be24273..c3645de6698 100644
--- a/lib/trace_events.js
+++ b/lib/trace_events.js
@@ -15,10 +15,14 @@ const {
} = require('internal/errors').codes;
const { ownsProcessState } = require('internal/worker');
-if (!hasTracing || !ownsProcessState)
+const {
+ CategorySet,
+ getEnabledCategories,
+ hasAgent,
+} = internalBinding('trace_events');
+if (!hasTracing || !ownsProcessState || !hasAgent())
throw new ERR_TRACE_EVENTS_UNAVAILABLE();
-const { CategorySet, getEnabledCategories } = internalBinding('trace_events');
const { customInspectSymbol } = require('internal/util');
const { format } = require('internal/util/inspect');
const {
diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc
index 5e01f64a503..08eb71c5122 100644
--- a/src/node_trace_events.cc
+++ b/src/node_trace_events.cc
@@ -114,6 +114,10 @@ void NodeCategorySet::Disable(const FunctionCallbackInfo& args) {
}
}
+static void HasAgent(const FunctionCallbackInfo& args) {
+ args.GetReturnValue().Set(tracing::Agent::GetInstance() != nullptr);
+}
+
void GetEnabledCategories(const FunctionCallbackInfo& args) {
Environment* env = Environment::GetCurrent(args);
std::string categories =
@@ -160,6 +164,7 @@ void NodeCategorySet::Initialize(Local