Skip to content

[Bug]: Build fails with "$returnValue cannot be retrieved" when app folder exists but is not in appFolders #2073

@NavNab

Description

@NavNab

AL-Go version

v8.1

Describe the issue

Description

The CI/CD pipeline fails with a $returnValue variable error in Download-BcNuGetPackageToFolder when an app folder (containing app.json) exists in the repository but is not included in the appFolders setting in .AL-Go/settings.json.

Steps to Reproduce

  1. Have a working AL-Go repository with multiple app folders
  2. Remove one app folder from the appFolders array in .AL-Go/settings.json, but keep the folder in the repository
  3. Push and trigger the CI/CD workflow
  4. Build fails during "Resolving dependencies" phase

Expected behavior

Expected Behavior

The build should ignore folders that are not listed in appFolders, even if they contain an app.json file.

Actual Behavior

The build fails with the following error:

Error: Unexpected error when running action. Error Message: The variable '$returnValue' cannot be retrieved because it has not been set., StackTrace: at Download-BcNuGetPackageToFolder, C:\ProgramData\BcContainerHelper\6.1.10\BcContainerHelper\NuGet\Download-BcNuGetPackageToFolder.ps1: line 335 <- at <ScriptBlock>, C:\actions-runner\_work\_actions\microsoft\AL-Go-Actions\v8.1\RunPipeline\RunPipeline.ps1: line 431 <- at <ScriptBlock>, C:\ProgramData\BcContainerHelper\6.1.10\BcContainerHelper\AppHandling\Run-AlPipeline.ps1: line 1531 <- at <ScriptBlock>, C:\ProgramData\BcContainerHelper\6.1.10\BcContainerHelper\AppHandling\Run-AlPipeline.ps1: line 1497 <- at <ScriptBlock>, C:\ProgramData\BcContainerHelper\6.1.10\BcContainerHelper\AppHandling\Run-AlPipeline.ps1: line 1285 <- at Run-AlPipeline, C:\ProgramData\BcContainerHelper\6.1.10\BcContainerHelper\AppHandling\Run-AlPipeline.ps1: line 1270 <- at <ScriptBlock>, C:\actions-runner\_work\_actions\microsoft\AL-Go-Actions\v8.1\RunPipeline\RunPipeline.ps1: line 477

Workaround

Adding the folder back to appFolders fixes the issue. Alternatively, deleting the folder entirely from the repository also works.

Environment

  • AL-Go version: v8.1
  • BcContainerHelper version: 6.1.10
  • Runner: Self-hosted Windows runner
  • BC Artifact: sandbox/27.2.42879.43954/fr

Steps to reproduce

Steps to reproduce

  • The same repository builds successfully when all app folders are included in appFolders
  • The issue occurs when a folder is removed from appFolders but the folder still exists in the repository
  • Clearing runner cache (C:\ProgramData\BcContainerHelper\*, C:\bcartifacts.cache\*, C:\actions-runner\_work\_actions\microsoft\AL-Go-Actions\*) does not resolve the issue
  • Setting useArtifactCache: false does not resolve the issue

Relevant Settings

.AL-Go/settings.json (working):

{
  "appFolders": [
    "App1",
    "App2",
    "App3"
  ]
}

.AL-Go/settings.json (failing - App3 folder still exists in repo):

{
  "appFolders": [
    "App1",
    "App2"
  ]
}

Additional context (logs, screenshots, etc.)

Suggested Fix

The dependency resolution logic should only consider folders explicitly listed in appFolders, ignoring any other folders in the repository that contain app.json files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions