Skip to content
'...' is an inline function that is not from a current session

'...' is an inline function that is not from a current session

DodaTech 2 min read

The “’…’ is an inline function that is not from a current session” error means the Kotlin compiler found stale inline bytecode from a prior compiler session.

What It Means

Kotlin inline functions are expanded at compile time by copying their bytecode into the call site. The compiler tracks which session produced each inline function’s bytecode. When the cached bytecode was built by a different compiler session — due to cache invalidation, incremental compilation, or daemon reuse — the compiler refuses to inline it and reports this error.

Why It Happens

  • A Gradle daemon session compiled the inline function, then the daemon restarted with different compiler settings.
  • Incremental compilation produced stale inline function caches.
  • You switched Kotlin versions between builds (e.g., back-and-forth between 1.9.0 and 2.0.0).
  • The build cache contains inline bytecode from a different project or module configuration.
  • IntelliJ’s build system (not Gradle) compiled some files while Gradle compiled others.

How to Fix It

1. Clean the build entirely

# Remove all build artifacts and caches
./gradlew clean
rm -rf .gradle/buildOutputCache

2. Clear the Gradle daemon cache

# Stop all running daemons
./gradlew --stop

# Clear the daemon's compiled output
rm -rf ~/.gradle/daemon
rm -rf ~/.gradle/caches/journal-*

3. Rebuild from scratch

# Fresh build with no cached bytecode
./gradlew clean build --no-build-cache --rerun-tasks

4. Invalidate IntelliJ caches

In IntelliJ IDEA: File → Invalidate Caches and Restart. This clears the IDE’s internal compiler cache which may have produced inline bytecode from a different session.

5. Disable incremental compilation (temporary fix)

// In build.gradle.kts
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
    incremental = false
}

After the build succeeds, re-enable incremental compilation for better performance.

6. Check for mixed Kotlin compiler versions

// build.gradle.kts — ensure all modules use the exact same Kotlin version
plugins {
    kotlin("jvm") version "2.0.0" apply false
}

// In each module:
plugins {
    kotlin("jvm")
}
Will this error happen in production builds?
It’s most common during development when switching branches or Kotlin versions. In CI/CD with clean builds, the error is rare because each build starts fresh without cached inline bytecode from a previous session.
What does “current session” refer to here?
A compiler “session” is the lifespan of a Gradle daemon or IDE compiler process. When the process restarts (new daemon, IDE restart), inline bytecode from the previous session may be stale. The “not from a current session” check enforces that inline bytecode was produced by the same compiler invocation.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro