{"record":{"id":"08cb2be3aa1aa4b4","repo":"JetBrains/intellij-community","slug":"no-scratch-file-associated-with-configuration","errorCode":null,"errorMessage":"No scratch file associated with configuration","messagePattern":"No scratch file associated with configuration","errorType":"validation","errorClass":"RuntimeConfigurationError","httpStatus":null,"severity":"error","filePath":"java/execution/impl/src/com/intellij/execution/scratch/JavaScratchConfiguration.java","lineNumber":69,"sourceCode":"public final class JavaScratchConfiguration extends ApplicationConfiguration {\n  JavaScratchConfiguration(String name, @NotNull Project project, @NotNull ConfigurationFactory factory) {\n    super(name, project, factory);\n  }\n\n  @Override\n  public boolean isBuildProjectOnEmptyModuleList() {\n    return false;\n  }\n\n  @Override\n  public void checkConfiguration() throws RuntimeConfigurationException {\n    JavaParametersUtil.checkAlternativeJRE(this);\n    final String className = getMainClassName();\n    if (className == null || className.isEmpty()) {\n      throw new RuntimeConfigurationError(ExecutionBundle.message(\"no.main.class.specified.error.text\"));\n    }\n    if (getScratchFileUrl() == null) {\n      throw new RuntimeConfigurationError(JavaCompilerBundle.message(\"error.no.scratch.file.associated.with.configuration\"));\n    }\n    if (getScratchVirtualFile() == null) {\n      throw new RuntimeConfigurationError(JavaCompilerBundle.message(\"error.associated.scratch.file.not.found\"));\n    }\n    ProgramParametersUtil.checkWorkingDirectoryExist(this, getProject(), getConfigurationModule().getModule());\n    JavaRunConfigurationExtensionManager.checkConfigurationIsValid(this);\n  }\n\n  @Override\n  public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {\n    final JavaCommandLineState state = new JavaApplicationCommandLineState<>(this, env) {\n      @Override\n      protected JavaParameters createJavaParameters() throws ExecutionException {\n        final JavaParameters params = super.createJavaParameters();\n        // After params are fully configured, additionally ensure JAVA_ENABLE_PREVIEW_PROPERTY is set,\n        // because the scratch is compiled with this feature if it is supported by the JDK\n        final Sdk jdk = params.getJdk();\n        if (jdk != null) {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/execution/impl/src/com/intellij/execution/scratch/JavaScratchConfiguration.java#L51-L87","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (configuration.getScratchFileUrl() == null) {\n  // configuration lost its scratch binding: recreate it by running the scratch again\n  return recreateConfiguration();\n}","typeGuard":null,"tryCatchPattern":"try {\n  configuration.checkConfiguration();\n} catch (RuntimeConfigurationError e) {\n  if (isScratchMissing(e)) deleteAndRecreateRunConfiguration();\n}","preventionTips":["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"],"tags":["scratch-file","run-configuration","stale-configuration","validation"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}