JetBrains/intellij-community · error · RuntimeConfigurationError
No scratch file associated with configuration
Error message
No scratch file associated with configuration
What it means
JavaScratchConfiguration.checkConfiguration throws RuntimeConfigurationError('No scratch file associated with configuration') when getScratchFileUrl() is null — the configuration exists but no scratch file URL has been bound to it (the scratch was deleted, its URL was never stored, or the configuration was copied/deserialized without the file reference).
Source
Thrown at java/execution/impl/src/com/intellij/execution/scratch/JavaScratchConfiguration.java:69
public final class JavaScratchConfiguration extends ApplicationConfiguration {
JavaScratchConfiguration(String name, @NotNull Project project, @NotNull ConfigurationFactory factory) {
super(name, project, factory);
}
@Override
public boolean isBuildProjectOnEmptyModuleList() {
return false;
}
@Override
public void checkConfiguration() throws RuntimeConfigurationException {
JavaParametersUtil.checkAlternativeJRE(this);
final String className = getMainClassName();
if (className == null || className.isEmpty()) {
throw new RuntimeConfigurationError(ExecutionBundle.message("no.main.class.specified.error.text"));
}
if (getScratchFileUrl() == null) {
throw new RuntimeConfigurationError(JavaCompilerBundle.message("error.no.scratch.file.associated.with.configuration"));
}
if (getScratchVirtualFile() == null) {
throw new RuntimeConfigurationError(JavaCompilerBundle.message("error.associated.scratch.file.not.found"));
}
ProgramParametersUtil.checkWorkingDirectoryExist(this, getProject(), getConfigurationModule().getModule());
JavaRunConfigurationExtensionManager.checkConfigurationIsValid(this);
}
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
final JavaCommandLineState state = new JavaApplicationCommandLineState<>(this, env) {
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
final JavaParameters params = super.createJavaParameters();
// After params are fully configured, additionally ensure JAVA_ENABLE_PREVIEW_PROPERTY is set,
// because the scratch is compiled with this feature if it is supported by the JDK
final Sdk jdk = params.getJdk();
if (jdk != null) {View on GitHub (pinned to be881553f2)
Solutions
- Delete the stale run configuration entry and re-run the scratch file directly (Run icon in the scratch editor) to regenerate it
- Or edit the configuration and re-associate the correct scratch file
- Ensure the scratch file actually exists under the Scratches view (View | Tool Windows | Scratches)
Defensive patterns
Strategy: validation
Validate before calling
if (configuration.getScratchFileUrl() == null) {
// configuration lost its scratch binding: recreate it by running the scratch again
return recreateConfiguration();
} Try / catch
try {
configuration.checkConfiguration();
} catch (RuntimeConfigurationError e) {
if (isScratchMissing(e)) deleteAndRecreateRunConfiguration();
} Prevention
- Delete run configurations when you delete their scratch files
- Do not share Java scratch run configurations across machines
- Re-run the scratch file itself to regenerate a valid configuration
When it happens
Trigger: A JavaScratchConfiguration run action where the underlying scratch file link is missing: scratch file deleted from disk, configuration XML referencing a stale/null URL, or invoking the configuration programmatically without setting the scratch file.
Common situations: Old workspace.xml run configurations whose scratch was removed; sharing a Java scratch run configuration to another machine where the scratch file does not exist; deleting the scratch but keeping the run entry.
Related errors
- No main class specified
- Associated scratch file not found
- Malformed exclusion, 'groupId:artifactName' format is expect
- Row %d failed: hierarchicalIdx cannot be null
- Row %d access failed: hierarchicalIdx cannot be empty
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/08cb2be3aa1aa4b4.
Report an issue: GitHub.