remotion-dev/remotion · error · Error
useMountTime must be used within a LogLevelProvider
Error message
useMountTime must be used within a LogLevelProvider
What it means
Thrown by the useMountTime() hook when the LogLevelContext value has mountTime === null. Like useLogLevel, the context default supplies 0, so this fires when a LogLevelProvider is given an incomplete value whose mountTime is explicitly null rather than when the hook is used outside any provider.
Source
Thrown at packages/core/src/log-level-context.tsx:27
export const LogLevelContext = createContext<LoggingContextValue>({
logLevel: 'info',
mountTime: 0,
});
export const useLogLevel = (): LogLevel => {
const {logLevel} = React.useContext(LogLevelContext);
if (logLevel === null) {
throw new Error('useLogLevel must be used within a LogLevelProvider');
}
return logLevel;
};
export const useMountTime = (): number => {
const {mountTime} = React.useContext(LogLevelContext);
if (mountTime === null) {
throw new Error('useMountTime must be used within a LogLevelProvider');
}
return mountTime;
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Ensure the provider's value.mountTime is a number (e.g. performance.now() or Date.now()).
- Default mountTime to 0 until the real value is available instead of null.
- Use Remotion's built-in LogLevelProvider to supply both logLevel and mountTime.
Example fix
// before
<LogLevelContext.Provider value={{logLevel: 'info', mountTime: null}}>
<App/>
</LogLevelContext.Provider>
// after
<LogLevelContext.Provider value={{logLevel: 'info', mountTime: Date.now()}}>
<App/>
</LogLevelContext.Provider> Defensive patterns
Strategy: validation
Validate before calling
const mountTime = useMountTimeSafe(); // where useMountTimeSafe reads context and falls back to 0 when null
Type guard
const isMountTime = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v);
Prevention
- Always supply a numeric mountTime in your LogLevelProvider value.
- Default to 0 until the real timestamp is available instead of null.
- Use Remotion's built-in LogLevelProvider to provide both context fields.
When it happens
Trigger: Rendering a LogLevelProvider whose value carries mountTime: null; a custom provider that has not yet recorded the mount timestamp; resetting context state to null.
Common situations: Custom providers that populate mountTime asynchronously; partial context objects passed to the provider; resetting context state on navigation.
Related errors
- useLogLevel must be used within a LogLevelProvider
- TimelineContext is not available. This hook must be used ins
- PlaybackRateContext is not available. This hook must be used
- AbsoluteTimeContext is not available. This hook must be used
- Tried to enable the buffering state, but a Remotion context
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/bec6de724d68213c.
Report an issue: GitHub.