Skip to content

Exit and diagnostic codes

kivyforge reports a failure in two ways that a script can branch on: the process exit code, and, with --json, diagnostics that each carry a stable KF-* code. The codes are a contract. The human-readable messages can change in any release, so never match on them.

Both tables on this page are generated from kivyforge's source. To read the same vocabularies at run time, run kivyforge capabilities --json.

Exit codes

Branch on the exit code first. It tells you the kind of failure without parsing any text.

Code Meaning Typical reaction
0 success Continue.
1 config or user error Fix pyproject.toml and retry.
2 usage error (click) Fix the command line. This is click's usage error; kivyforge never raises it deliberately.
3 environment or toolchain missing Install the missing tool, then retry the same command.
4 lock file out of date Re-lock with kivyforge lock -p <platform>.
5 build failed Read the build log on stderr; the toolchain ran and reported an error.

Exit code 2 belongs to the command-line parser: it means a mistyped flag or argument. kivyforge never uses 2 for its own failures, so a usage error stays distinct from a missing toolchain.

Diagnostic codes

With --json, each entry in the envelope's diagnostics array has a code, severity, and message, and optionally remediation and context. See JSON output for the full shape. A diagnostic on an ok: true run is a warning, not a failure.

Code Severity Meaning Remediation
KF-ANDROID-APP-CONFLICT error Android: app_dir has its own android.py or android/, which the bundled android package would shadow. Rename or remove it; context names the path.
KF-ANDROID-DEPENDENCY-CONFLICT error Android: a dependency provides its own android module. kivyforge bundles an android package, which would shadow it. Remove the dependency, or add it to [tool.kivy.android].exclude if another package pulls it in; context names the distribution.
KF-ANDROID-INCLUDE-OVERRIDE info Android: an include_files file replaced one kivyforge generates, such as res/values/styles.xml or the launcher icon. The build goes on. None if the override is deliberate; context names the path.
KF-ANDROID-NATIVE-LIB-MISALIGNED error Android: the built APK or AAB holds a native library the device cannot load, because a segment's file offset and address disagree. Usually the strip during packaging damaged a library patchelf had edited. Set strip_native_libs = false and report the wheel; context names the library.
KF-ANDROID-WHEEL-ARCH error Android: a native library is built for another architecture than the ABI its wheel is tagged for, so it would fail to load on the device. Report it to the wheel's publisher and lock a correct wheel; context names the library, its distribution and the abi.
KF-ANDROID-WHEEL-LAYOUT error Android: locked wheels ship their native libraries under opt/lib, Chaquopy's layout for separate library wheels, which Flet's index serves. kivyforge cannot load libraries from there. Lock the package that requires them from an index whose wheels carry their own libraries; context names the distributions.
KF-ANDROID-WHEEL-SUFFIX error Android: an extension module is named with a suffix CPython on Android does not import, such as a build host's or another Python version's. Report it to the wheel's publisher and lock a correct wheel; context names the library, its distribution and the abi.
KF-ARTIFACT-CONTENT error The product was built, but a file from include_files is missing from it or differs from the copy that was staged. Read the build log for the step that converted or dropped the file, and report it; kivyforge copies includes byte for byte.
KF-ARTIFACT-MISSING error A build tool reported success but the product is not where it should be. Read the build log; this usually points at a broken toolchain step.
KF-BUILD-TOOL-FAILED error A build tool (Gradle, xcodebuild, appimagetool) ran and exited non-zero. Read the build log on stderr; context names the tool and task.
KF-BYTECOMPILE-NO-INTERP error or warning No interpreter could byte-compile: the host CPython the lock pins has no build of the minor yet, downloads are off and nothing is cached, or (on desktop) the staged runtime is missing and no CPython of the minor was found. A warning when the build shipped source; an error, exit 3, with byte_compile = true. Follow the message's Fix: line: re-lock once a build is published, run kivyforge upgrade -p <platform> with network access, or set byte_compile = false.
KF-DEPENDENCY-DRIFT warning An installed dependency sits outside the specifier pyproject.toml declares. Align the installed version, or widen the specifier. Nothing was modified.
KF-DOCTOR-CHECK warning A doctor check reported WARN or FAIL and has no specific code yet. See data.checks, keyed by the check name.
KF-ENTITLEMENTS-UNGRANTED warning Retired: no longer emitted. It warned that a profile pinned under iOS automatic signing lacked a declared entitlement; Xcode refuses any pin under automatic signing, so that build now fails before xcodebuild. None. The code stays reserved and will not be reused.
KF-ERROR error An expected failure with no more specific code assigned yet. Read the diagnostic's message and remediation.
KF-HOST-INCAPABLE error This host cannot build this target at all (for example iOS from Windows). Build on a supported host; see the host matrix.
KF-HOST-PYTHON-FETCH error The host CPython the lock pins couldn't be fetched or looked up: no network, a GitHub rate limit, a SHA-256 mismatch, or another build installing it. Exit 3. Retry with network access; in CI, set GITHUB_TOKEN. For a mismatch, check KIVYFORGE_HOST_PYTHON_MIRROR, or re-lock with --update.
KF-IDE-NOT-FOUND warning open found no IDE launcher on PATH. The project exists and can be opened by hand. Install the platform IDE, or open the generated project manually.
KF-INCLUDE-NATIVE-CODE error An include_files file is native code (a Mach-O or a static archive), which would ship unsigned. List it under the platform's native-code key, which signs it.
KF-INCLUDE-RESERVED error An include_files entry would replace a file the generated build writes, or (iOS) uses a code-bundle name such as X.framework. Pick another dest, or set the value through the key the message names.
KF-INCLUDE-SOURCE-FORMAT error An include_files path is a format Xcode compiles (.xcstrings, .storyboard, .xib, .xcassets), which would ship verbatim and do nothing. Include the compiled form, or use the key the message names.
KF-IOS-KIVY-UNSUPPORTED error iOS: the project would run Kivy 2.x, which kivyforge does not build there; iOS builds are Kivy 3 only. lock refuses a kivy requirement that admits no 3.x release, and a resolved 2.x; build refuses a lock that pins one. Require Kivy 3 (for example kivy>=3.0,<4) and re-lock; kivy-ios serves Kivy 2.x. context names the requirement or the version.
KF-IOS-LEGACY-IOS-MODULE warning iOS: a .py file under app_dir imports the kivy-ios ios module, which kivyforge does not provide. The import may be guarded, so the build goes on. Quiet when app_dir has its own ios.py or ios/. Replace it with kivy.mobile and the standard library; the migration guide maps each name. context names the first file, its line and the number of files.
KF-LOCK-DRIFT error A lock input in pyproject.toml (a dependency, the Python version, an index, a native library) changed since the lock was written. Run kivyforge lock -p <platform>; it keeps the versions already locked.
KF-LOCK-INCOMPLETE error The lock matches pyproject.toml but predates something kivyforge now adds to it: the host CPython that byte-compiles (iOS, Android, Linux aarch64), or on Android pyjnius, which Kivy needs at launch. For the host CPython, a plain kivyforge lock -p <platform> adds it and keeps every other pin; for pyjnius, re-lock with --update.
KF-LOCK-INDEX-UNREACHABLE error pip lost its connection to a package index or file host while resolving, and gave up. Exit 3. Nothing in the project is at fault. Retry with network access; context names the host when pip did.
KF-LOCK-MISSING error No pylock.<platform>.toml exists for the target. Run kivyforge lock -p <platform>.
KF-LOCK-PINS-CONFLICT error lock could not resolve the changed lock inputs while keeping the versions already in the lock, though it can without them. Run kivyforge lock -p <platform> --update to take the newest version of everything, or pin the package that has to move.
KF-LOCK-SOURCE-UNAVAILABLE error A package that comes from one source only (a pin in sources, or a wheel in find_links) has no wheel there for one of the targets being locked. kivyforge does not fall back to another source. Pin the package to an index that has the wheel, or add the missing wheel to the find_links directory.
KF-LOCK-UNREADABLE error A lock exists but could not be parsed (a bad merge or a truncated write). Re-create it with kivyforge lock -p <platform>.
KF-LOCK-WARNING warning Resolution made a judgement call worth surfacing. The lock is usable and the run is ok. Read the note; no action is required unless it surprises you.
KF-MACOS-NATIVE-LOAD-PATH error or warning macOS: a native binary links a declared library by a path that does not reach it in Contents/Frameworks/, in a process that loads it. A warning when the link is weak, or when Python loads it by its install name and the app can load the library first. Relink with install_name_tool: link the library as @rpath/<name>, and add an rpath of @executable_path/../Frameworks to a helper or @loader_path to a library. The message gives the commands.
KF-MACOS-NATIVE-NOT-CODE error or warning macOS: a native.binaries file is not a Mach-O. The channel places native code only. An error for a single-file source; archive members are skipped with a warning. Put data under include_files and scripts under app_dir.
KF-MACOS-NATIVE-UNSUPPORTED error macOS: a native.binaries file is code the channel cannot place: a Mach-O other than an executable or a dynamic library (a plug-in, an object file), a universal file whose slices disagree, or a file inside a bundle (.framework, .app) in an archive. Ship the executable or .dylib itself; plug-ins and bundles are not supported.
KF-MANIFEST-POLICY info The Android release-manifest policy passed with an informational finding. Review the finding; no action is required.
KF-METADATA-ENTRY-POINTS-OUTSIDE-PROJECT error A setuptools project declares entry points in setup.cfg or setup.py and none in [project], where kivyforge reads them to write the app's package metadata. Exit 1; context names the path. Move them into [project.entry-points] (console scripts into [project.scripts], GUI scripts into [project.gui-scripts]).
KF-METADATA-NOT-GENERATED warning [project].dynamic lists entry-points, scripts or gui-scripts, so kivyforge writes no package metadata for the app. context: reason (dynamic or static-and-dynamic) and fallback, the development egg-info that ships instead, or none. Declare the entry points statically in [project]; until then, run pip install -e . before each build.
KF-PATH-DEPTH warning A Windows onedir bundle nests so deep it only runs from a short folder while long paths are off (the Windows default). The artifact is fine; where it is unpacked is the constraint. Install to a short folder, or enable long paths on the target machines.
KF-SIGNING-UNCONFIGURED warning The package shipped unsigned or ad-hoc signed where real signing is available. Configure signing for the platform, or ship unsigned deliberately.
KF-TOOLCHAIN-MISSING error A required tool is not installed. Install the named tool and retry.
KF-TOOLCHAIN-UNUSABLE error A tool is present but could not be executed. Fix the file's permissions or executability; context.errno says why.
KF-VERSION-APPLE-FORMAT error or warning The version is not one to three dot-separated numbers, which App Store Connect refuses (ITMS-90060). An error for an iOS app-store export, a warning for other iOS exports and macOS package. Build from a release tag, pass --app-version 1.2.3, or export with --export-method ad-hoc or development.
KF-VERSION-FILE-NOT-REFRESHED warning setuptools-scm's version_file was not rewritten, because the version came from --app-version or pyproject.toml. Pin with SETUPTOOLS_SCM_PRETEND_VERSION instead of --app-version.
KF-VERSION-ISOLATION-UNUSED info --no-build-isolation had no effect: the version is static, so the build backend did not run. Nothing to do; drop the flag for this project.
KF-VERSION-UNRESOLVED error pip could not produce the dynamic [project].version: the build backend failed (not a git checkout, no tags) or the package index was unreachable. Check pip wheel --no-deps . works; in CI fetch tags (fetch-depth: 0); or pass --app-version.

What's next