metricsign
Start free
Medium severityconfigurationMicrosoft Fabric

Power BI Refresh Error:
Fabric Pipeline Error 2504

What does this error mean?

The Azure Batch activity returned a BadRequest status because the total size of file paths in the folderPath exceeds the 32,768-character limit for resourceFiles. Reduce the number of files or compress them into a zip archive.

Common causes

  • 1Too many individual files listed in the folderPath for the Azure Batch activity, causing the resourceFiles string to exceed 32,768 characters
  • 2Deep or lengthy folder paths that consume the character limit even with a moderate number of files
  • 3Incremental file accumulation in the target folder over time that eventually crosses the limit
  • 4No file cleanup or archiving strategy in place for the Batch resource directory

How to fix it

  1. 1Step 1: Audit the folderPath used in the Azure Batch activity and count the number of files; identify any files that are not required for the current execution.
  2. 2Step 2: Remove unnecessary files from the folderPath in Azure Storage, or move them to an archive container that is not referenced by the activity.
  3. 3Step 3: Compress remaining required files into a single zip archive and upload it to the folderPath, reducing the total number of resource file entries.
  4. 4Step 4: Add an unzip command to your Batch activity command line, for example: powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory($zipFile, $folder); }" ; $folder\yourProgram.exe
  5. 5Step 5: Re-run the pipeline and monitor that the total resourceFiles path length stays well below 32,768 characters to avoid recurrence.

Frequently asked questions

Is there a way to increase the 32,768-character resourceFiles limit in Azure Batch?

No, this is a hard platform limit for Azure Batch resourceFiles. The recommended workaround is to zip files and extract them as part of the Batch command, keeping the resource file reference count minimal.

How can I prevent this from happening again as files accumulate?

Implement a cleanup step in your pipeline or an Azure Function that deletes or archives processed files from the Batch folderPath after each successful run, ensuring the directory stays within the character limit.

Other configuration errors