1

What is maximum value of -w (wait) parameter of sf org scratch create command?

We need the max value for wait attribute in org scratch creation command to avoid the error which we receive often

Org creation failed with error ScratchOrgInfoTimeout ScratchOrgInfoTimeout: The client has timed out. at PollingClient.subscribe (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/core/lib/status/pollingClient.js:91:19) at async pollForScratchOrgInfo (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/core/lib/org/scratchOrgInfoApi.js:303:34) at async scratchOrgCreate (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/core/lib/org/scratchOrgCreate.js:165:17) at async Create.createScratchOrg (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/plugin-org/lib/commands/force/org/create.js:187:68) at async Create._run (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/command/lib/sfdxCommand.js:102:40) at async Config.runCommand (/usr/local/lib/node_modules/sfdx-cli/node_modules/@oclif/core/lib/config/config.js:272:25) at async run (/usr/local/lib/node_modules/sfdx-cli/node_modules/@oclif/core/lib/main.js:74:5)

from CI step of org creation.

Probably we should increase or set -w parameter, which default value if 6 minutes. However, which is the maximum value to avoid this error?

1 Answer 1

3

Not found in the documentation.

However, if we try to experiment we will find out the following results:

sfdx force:org:create -s -d 30 -a o$(( RANDOM % 1000)) -f config/manual.json -w 9999999999999999999999
(node:45988) TimeoutOverflowWarning: 6.0000000000000006e+26 does not fit into a 32-bit signed integer.
Timeout duration was set to 1.
(Use `node --trace-warnings ...` to show where the warning was created)
ERROR running force:org:create:  The client has timed out.

Clearly -w parameter should be less than maximum value of 32-bit signed integer, which is (2^31) - 1 or 2147483647.

Further, let's try to pass the value of max signed int into -w parameter

sfdx force:org:create -s -d 30 -a o$(( RANDOM % 1000)) -f config/manual.json -w 2147483647
(node:46082) TimeoutOverflowWarning: 128849018820000 does not fit into a 32-bit signed integer.
Timeout duration was set to 1.
(Use `node --trace-warnings ...` to show where the warning was created)

Ok, looks like the minutes parameter is multiplied by 60000 to be converted into number of milliseconds and that value should be less than max signed int. So let's just divide 2147483647 by 60000 and take floor of the result.

sfdx force:org:create -s -d 30 -a o$(( RANDOM % 1000)) -f config/manual.json -w 35791
Successfully created scratch org: 00D8N0000005l0YUAQ, username: [email protected].

So, the maximum value is 35791

2
  • Just shy of 25 days. I'm pretty sure that's more than enough for anyone. 😅
    – sfdcfox
    Jan 24, 2023 at 18:35
  • @sfdcfox I hope the error ScratchOrgInfoTimeout ScratchOrgInfoTimeout: The client has timed out. won't bother me anymore
    – Patlatus
    Jan 25, 2023 at 10:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .