When attempting to internalize this package using choco download --internalize, the process fails with a 404 error:
The remote file either doesn't exist, is unauthorized, or is forbidden for url
'https://github.com/anomalyco/opencode/releases/download/v$env:chocolateyPackageVersion/opencode-windows-x64.zip'
The Chocolatey package internalizer works by doing a static text scan of the install script to find and download URLs — it does not execute the PowerShell. In tools/chocolateyinstall.ps1, the download URL is built using a runtime variable:
$version = $env:chocolateyPackageVersion
$url64 = "https://github.com/anomalyco/opencode/releases/download/v$version/opencode-windows-x64.zip"
Because $version is never resolved at scan time, the internalizer constructs the literal URL https://github.com/.../v$env:chocolateyPackageVersion/... and hits a 404.
The update.ps1 script already rewrites the checksum to a hardcoded value on each release. It should also rewrite the URL version to a literal string, so that each published .nupkg contains a fully resolved, static URL such as:
$url64 = 'https://github.com/anomalyco/opencode/releases/download/v1.14.29/opencode-windows-x64.zip'
This means adding a version replacement step in update.ps1 alongside the existing checksum replacement:
# Replace placeholder version in URL so published nupkg has a static, internalizable URL
$installScript = $installScript -replace 'releases/download/v[^/]+/opencode', "releases/download/v$latestVersion/opencode"
And updating tools/chocolateyinstall.ps1 to use a placeholder that update.ps1 can rewrite:
$url64 = 'https://github.com/anomalyco/opencode/releases/download/vPLACEHOLDER_VERSION/opencode-windows-x64.zip'
When attempting to internalize this package using choco download --internalize, the process fails with a 404 error:
The Chocolatey package internalizer works by doing a static text scan of the install script to find and download URLs — it does not execute the PowerShell. In tools/chocolateyinstall.ps1, the download URL is built using a runtime variable:
Because $version is never resolved at scan time, the internalizer constructs the literal URL https://github.com/.../v$env:chocolateyPackageVersion/... and hits a 404.
The update.ps1 script already rewrites the checksum to a hardcoded value on each release. It should also rewrite the URL version to a literal string, so that each published .nupkg contains a fully resolved, static URL such as:
$url64 = 'https://github.com/anomalyco/opencode/releases/download/v1.14.29/opencode-windows-x64.zip'This means adding a version replacement step in update.ps1 alongside the existing checksum replacement:
And updating tools/chocolateyinstall.ps1 to use a placeholder that update.ps1 can rewrite:
$url64 = 'https://github.com/anomalyco/opencode/releases/download/vPLACEHOLDER_VERSION/opencode-windows-x64.zip'