cli icon indicating copy to clipboard operation
cli copied to clipboard

ERROR running force:source:beta:pull: Cannot read properties of null (reading 'length')

Open abenavides333 opened this issue 3 years ago • 5 comments

Summary

I'm using the beta version to pull the changes in my instance org but I'm getting the following error: Cannot read properties of null (reading 'length'). Even though the error is raised, the process continues and downloads the latest changes from the instance as expected.

I'm not working with a scratch org but a sandbox instance for development. Thanks!

Steps To Reproduce:

  1. Check for changes: sfdx force:source:beta:status -r -u [org]
  2. Pulls the latest changes: sfdx force:source:beta:pull -f -u [org]

Expected result

Local sources should be updated with the changes pulled from the remote sandbox org.

Actual result

The local sources are updated but the process throws the following error first:

$ sfdx force:source:beta:pull -f -u [org]
ERROR running force:source:beta:pull:  Cannot read properties of null (reading 'length')
Loading source tracking information... done

Sometimes I get a more details:

$ sfdx force:source:beta:pull -f -u AuctionAngelaDev
ERROR running force:source:beta:pull:  Cannot read properties of null (reading 'length')
Error: EMFILE: too many open files, open 'C:\Users\abena\AppData\Local\sfdx\client\7.134.0-4f69b20\node_modules\@oclif\errors\handle.js'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1118:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:822:12)
    at Function._load (C:\Users\abena\AppData\Local\sfdx\client\7.134.0-4f69b20\node_modules\@salesforce\lazy-require\lib\LazyLoader.js:99:24)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at C:\Users\abena\AppData\Local\sfdx\client\7.134.0-4f69b20\bin\run:51:9
    at runNextTicks (node:internal/process/task_queues:61:5)
    at processTimers (node:internal/timers:497:9) {
  errno: -4066,
  syscall: 'open',
  code: 'EMFILE',
  path: 'C:\\Users\\abena\\AppData\\Local\\sfdx\\client\\7.134.0-4f69b20\\node_modules\\@oclif\\errors\\handle.js'
}
Error: EMFILE: too many open files, open 'C:\Users\abena\AppData\Local\sfdx\client\7.134.0-4f69b20\node_modules\@oclif\errors\handle.js'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1118:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:822:12)
    at Function._load (C:\Users\abena\AppData\Local\sfdx\client\7.134.0-4f69b20\node_modules\@salesforce\lazy-require\lib\LazyLoader.js:99:24)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at C:\Users\abena\AppData\Local\sfdx\client\7.134.0-4f69b20\bin\run:51:9
    at runNextTicks (node:internal/process/task_queues:61:5)
    at processTimers (node:internal/timers:497:9) {
  errno: -4066,
  syscall: 'open',
  code: 'EMFILE',
  path: 'C:\\Users\\abena\\AppData\\Local\\sfdx\\client\\7.134.0-4f69b20\\node_modules\\@oclif\\errors\\handle.js'
}
Loading source tracking information... done

System Information

{
        "cliVersion": "sfdx-cli/7.134.0",
        "architecture": "win32-x64",
        "nodeVersion": "node-v16.13.2",
        "pluginVersions": [
                "@oclif/plugin-autocomplete 0.3.0 (core)",
                "@oclif/plugin-commands 1.3.0 (core)",
                "@oclif/plugin-help 3.3.1 (core)",
                "@oclif/plugin-not-found 1.2.6 (core)",
                "@oclif/plugin-plugins 1.10.11 (core)",
                "@oclif/plugin-update 1.5.0 (core)",
                "@oclif/plugin-warn-if-update-available 1.7.3 (core)",
                "@oclif/plugin-which 1.0.4 (core)",
                "@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
                "alias 1.2.0 (core)",
                "apex 0.7.0 (core)",
                "auth 1.8.0 (core)",
                "config 1.3.14 (core)",
                "custom-metadata 1.0.12 (core)",
                "data 0.6.8 (core)",
                "generator 1.2.1 (core)",
                "info 1.2.0 (core)",
                "limits 1.3.0 (core)",
                "org 1.11.0 (core)",
                "salesforce-alm 53.7.2 (core)",
                "schema 1.1.0 (core)",
                "sfdx-cli 7.134.0 (core)",
                "source 1.8.0 (core)",
                "telemetry 1.4.0 (core)",
                "templates 53.1.0 (core)",
                "trust 1.1.0 (core)",
                "user 1.7.0 (core)"
        ],
        "osVersion": "Windows_NT 10.0.19042"
}

abenavides333 avatar Jan 31 '22 18:01 abenavides333

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

github-actions[bot] avatar Jan 31 '22 18:01 github-actions[bot]

Are you able to share what metadata type caused this to happen, and what the change was (create, modify, delete) that leads to the error?

And around how many changes were in that transaction?

Any way to reliably recreate the error?

mshanemc avatar Jan 31 '22 20:01 mshanemc

Sure, for example, I was just working on changing a custom apex class (removing an old method that won't be used anymore) and updating the API version in the class from 44 to 53.

This is the output for: sfdx force:source:beta:status -r -u [org]

Source Status
STATE           FULL NAME                                 TYPE         PROJECT PATH
──────────────  ────────────────────────────────────────  ───────────  ────────────────────────────────────────────────────────────────────────────────────
Remote Add      REDACTED                                  Profile
Remote Add      REDACTED                                  Profile
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Add      REDACTED                                  WaveDataset
Remote Changed  REDACTED                                  ApexClass    force-app\main\default\classes\REDACTED.cls-meta.xml
Remote Changed  REDACTED                                  ApexClass    force-app\main\default\classes\REDACTED.cls
Remote Changed  REDACTED                                  ApexClass    force-app\main\default\classes\REDACTED.cls-meta.xml
Remote Changed  REDACTED                                  ApexClass    force-app\main\default\classes\REDACTED.cls
Remote Changed  REDACTED                                  Profile      force-app\main\default\profiles\REDACTED.profile-meta.xml

And this is the output for: sfdx force:source:beta:pull -f -u [org]

ERROR running force:source:beta:pull:  Cannot read properties of null (reading 'length')
Loading source tracking information... done

abenavides333 avatar Jan 31 '22 21:01 abenavides333

Hi, that's quite an old version you're running, can you please try upgrading the CLI to the latest version (possible the latest-rc) and try the command again, source tracking library has undergone several changes since then.

maggiben avatar Mar 23 '22 04:03 maggiben

I am getting a simliar error in Powershell on Windows 10 using CLI 7.167.2 (sfdx-cli/7.167.2 win32-x64 node-v16.17.0)

sfdx force:org:shape:list ERROR running force:org:shape:list: Cannot read properties of undefined (reading 'length')

CLI Version: sfdx-cli/7.167.2

Architecture: win32-x64

Node Version: node-v16.17.0

Plugin Version: @oclif/plugin-autocomplete 1.3.0 (core) @oclif/plugin-commands 2.2.0 (core) @oclif/plugin-help 5.1.12 (core) @oclif/plugin-not-found 2.3.1 (core) @oclif/plugin-plugins 2.1.0 (core) @oclif/plugin-update 3.0.0 (core) @oclif/plugin-version 1.1.2 (core) @oclif/plugin-warn-if-update-available 2.0.4 (core) @oclif/plugin-which 2.1.0 (core) alias 2.1.0 (core) apex 1.2.0 (core) auth 2.2.3 (core) community 2.0.1 (core) config 1.4.19 (core) custom-metadata 2.0.0 (core) data 2.1.2 (core) generator 2.0.2 (core) info 2.0.1 (core) limits 2.0.1 (core) org 2.2.0 (core) packaging 1.6.0 (core) schema 2.1.1 (core) signups 1.2.0 (core) source 2.0.13 (core) telemetry 2.0.0 (core) templates 55.1.0 (core) trust 2.0.3 (core) user 2.1.0 (core) @salesforce/sfdx-plugin-lwc-test 1.0.1 (core) salesforce-alm 54.8.1 (core)

OS and Version: Windows_NT 10.0.19044

Shell: cmd.exe

Root Path: C:\Users\mmmma\AppData\Local\sfdx\client\7.167.2-93d663e

marsh-mellow avatar Sep 12 '22 15:09 marsh-mellow

We fixed a bug in a library that was causing some commands to throw this error some months ago, I'll close this issue but if someone still experience this on latest please do open a new issue.

cristiand391 avatar Jan 03 '23 21:01 cristiand391