chocolatey/choco · error · ApplicationException
Force dependencies can only be used with force also turned o
Error message
Force dependencies can only be used with force also turned on.
What it means
ForceDependencies is only meaningful alongside Force. Validate() throws when configuration.ForceDependencies is true but configuration.Force is false, because forcing dependency operations without forcing the primary operation is unsupported and can leave inconsistent state.
Source
Thrown at src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs:243
}
}
public virtual void Validate(ChocolateyConfiguration configuration)
{
if (string.IsNullOrWhiteSpace(configuration.PackageNames))
{
throw new ApplicationException("Package name is required. Please pass at least one package name to install.");
}
// Need a better check on this before releasing. Issue will be covered by other fixes
//// investigate https://msdn.microsoft.com/en-us/library/system.io.path.getinvalidpathchars(v=vs.100).aspx
//if (configuration.PackageNames.Contains(":"))
//{
// throw new ApplicationException("Package name cannot contain invalid characters.");
//}
if (configuration.ForceDependencies && !configuration.Force)
{
throw new ApplicationException("Force dependencies can only be used with force also turned on.");
}
if (!string.IsNullOrWhiteSpace(configuration.Input))
{
var unparsedOptionsAndPackages = configuration.Input.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
if (!configuration.Information.IsLicensedVersion)
{
foreach (var argument in unparsedOptionsAndPackages.OrEmpty())
{
var arg = argument.ToLowerSafe();
if (arg.StartsWith("-dir") || arg.StartsWith("--dir") || arg.StartsWith("-install") || arg.StartsWith("--install"))
{
throw new ApplicationException("It appears you are attempting to use options that may be only available in licensed versions of Chocolatey ('{0}'). There may be ways in the open source edition to achieve what you are looking to do. Please remove the argument and consult the documentation.".FormatWith(arg));
}
}
}
}
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Always pair --force-dependencies with --force: 'choco install <pkg> --force --forcedependencies'.
- Drop --force-dependencies if you only want to force the primary package.
- Review chocolatey.config to ensure both flags align.
Example fix
# before choco install pkg --forcedependencies # after choco install pkg --force --forcedependencies
Defensive patterns
Strategy: validation
Validate before calling
// ForceDependencies requires Force.
if (forceDependencies && !force)
{
throw new InvalidOperationException("--force-dependencies requires --force");
}
var args = forceDependencies && force ? "--force --force-dependencies" : ""; Prevention
- Treat --force-dependencies as always paired with --force.
- Audit chocolatey.config so the two flags are consistent.
When it happens
Trigger: Running 'choco install <pkg> --forcedependencies' (or -x without --force), setting ForceDependencies without also setting Force.
Common situations: Passing --force-dependencies alone expecting it implies --force; scripts carrying over only one of the two flags; config that sets forceDependencies but not force.
Related errors
- Force dependencies can only be used with force also turned o
- Package name is required. Please pass at least one package n
- Alternative sources do not allow the use of the 'all' packag
- Stopping further execution as {0} has failed.
- A single apikey command must be listed. Please see the help
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/23fd561f4bf142ec.
Report an issue: GitHub.