zowe zmf plugin gives error on "put" requests

Hello,

I noticed, that since a few days ago, the ZMF Plugin for Zowe, doesn't let me complete "put" requests, like zowe zmf freeze pkg -p "BK# 014585. 

This gives me following error message in the Console:

PS C:\Users\ris0186> zowe zmf freeze pkg -p "BK# 014585"
Command Error:
The put request appeared to succeed, but the response was not in the expected format:
Unexpected token < in JSON at position 0
Error Details:
Unexpected token < in JSON at position 0
PS C:\Users\ris0186>

I tried the Freeze command with the REST SERVICE site, there it works flawlessly.

But if I take the URL and try to call it with Python and the import Requests (did work for me previously) I get the same error.
I also tried the Promote command, but same result. If I execute a "GET" request it works. E.g. zowe zmf get ps -p 'BK# *' --cr 'UBRAF' --ds 'Y' --fs 'Y'.

I looked in the Logs, but didn't find a lot:

[2024/07/04 08:57:57.520] [ERROR] [CommandProcessor.js:943] Handler for package rejected by thrown ImperativeError.
[2024/07/04 08:57:57.524] [INFO] [CommandProcessor.js:919] Command "package" completed with success flag: "false"
[2024/07/04 08:57:57.525] [TRACE] [CommandProcessor.js:920] Command "package" finished. Response object:
{
  success: false,
  exitCode: 1,
  message: 'The put request appeared to succeed, but the response was not in the expected format:\n' +
    'Unexpected token < in JSON at position 0',
  stdout: <Buffer >,
  stderr: <Buffer 1b 5b 33 31 6d 43 6f 6d 6d 61 6e 64 20 45 72 72 6f 72 3a 1b 5b 33 39 6d 0a 1b 5b 33 31 6d 1b 5b 33 39 6d 54 68 65 20 70 75 74 20 72 65 71 75 65 73 74 ... 188 more bytes>,
  data: {},
  error: {
    msg: 'The put request appeared to succeed, but the response was not in the expected format:\n' +
      'Unexpected token < in JSON at position 0',
    stack: 'SyntaxError: Unexpected token < in JSON at position 0\n' +
      '    at JSON.parse (<anonymous>)\n' +
      '    at JSONUtils.parse (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\utilities\\src\\JSONUtils.js:42:29)\n' +
      '    at RestClient.<anonymous> (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\rest\\src\\client\\RestClient.js:70:42)\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at fulfilled (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\rest\\src\\client\\RestClient.js:15:58)\n' +
      '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
    additionalDetails: 'Unexpected token < in JSON at position 0',
    causeErrors: SyntaxError: Unexpected token < in JSON at position 0
        at JSON.parse (<anonymous>)
        at JSONUtils.parse (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\utilities\src\JSONUtils.js:42:29)
        at RestClient.<anonymous> (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\rest\src\client\RestClient.js:70:42)
        at Generator.next (<anonymous>)
        at fulfilled (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\rest\src\client\RestClient.js:15:58)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  }
}
[2024/07/04 08:57:57.527] [ERROR] [CommandYargs.js:148] Error in command package
[2024/07/04 08:57:57.528] [ERROR] [CommandYargs.js:149] [
  {
    success: false,
    exitCode: 1,
    message: 'The put request appeared to succeed, but the response was not in the expected format:\n' +
      'Unexpected token < in JSON at position 0',
    stdout: <Buffer >,
    stderr: <Buffer 1b 5b 33 31 6d 43 6f 6d 6d 61 6e 64 20 45 72 72 6f 72 3a 1b 5b 33 39 6d 0a 1b 5b 33 31 6d 1b 5b 33 39 6d 54 68 65 20 70 75 74 20 72 65 71 75 65 73 74 ... 188 more bytes>,
    data: {},
    error: {
      msg: 'The put request appeared to succeed, but the response was not in the expected format:\n' +
        'Unexpected token < in JSON at position 0',
      stack: 'SyntaxError: Unexpected token < in JSON at position 0\n' +
        '    at JSON.parse (<anonymous>)\n' +
        '    at JSONUtils.parse (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\utilities\\src\\JSONUtils.js:42:29)\n' +
        '    at RestClient.<anonymous> (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\rest\\src\\client\\RestClient.js:70:42)\n' +
        '    at Generator.next (<anonymous>)\n' +
        '    at fulfilled (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\rest\\src\\client\\RestClient.js:15:58)\n' +
        '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
      additionalDetails: 'Unexpected token < in JSON at position 0',
      causeErrors: SyntaxError: Unexpected token < in JSON at position 0
          at JSON.parse (<anonymous>)
          at JSONUtils.parse (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\utilities\src\JSONUtils.js:42:29)
          at RestClient.<anonymous> (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\rest\src\client\RestClient.js:70:42)
          at Generator.next (<anonymous>)
          at fulfilled (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\rest\src\client\RestClient.js:15:58)
          at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    }
  }
]

I tried a put request with zowe, and it works, so it's not a Problem of zowe.


OS: Windows 10
Node: 18.12.0
Zowe CLI: 7.24.0
ZMF: 2.0.5
Python: 3.12.4
VS-Code: 1.90.2

Labels:

ChangeMan ZMF
  • 0  

    Are you saying that this used to work up until recently?

    If so , have you changed any underlying components etc as the ZMF CLI plugin has not changed in some time. Have you recently upgraded zowe cli etc?

    Also you say:

    But if I take the URL and try to call it with Python and the import Requests (did work for me previously) I get the same error.

    Can you please clarify this comment? What URL are you referring to here? Please provide the example of this


    The error message:

    Unexpected token < in JSON at position 0

    seems to suggest that you are possibly getting HTML returned and not JSON

    are you able to see what is actually being returned? if so please provide that information.

    Can you please provide the zowe imperative log as the error is occurring in the zowe RestClient attempting to parse the returned JSON.

  • 0 in reply to   

    Hi, Yes it worked for me last week.
    No I haven't upgraded anythin in the mean time.

    If you make a call with the REST API


    After clicking on "test" 



    Then you have the option to:

    • Test API
    • Show URL
    • Show JSON
    • Return

    If I click "show URL" I get the URL and I can make a Service call with this URL using Python.

    It worked for me last week.

  • 0   in reply to 

    What version of Rest Services are you running?  Has  Rest Services possibly been updated in the past week? 

  • 0 in reply to   

    We have the Build Version: 830
    And no, it doesn;t look like it. If it's the build date, it was updated on Feb 13, 2023

  • 0   in reply to 

    Can you please provide the output of what you actually got back from your Python call?

    Also - is there a zowe imperatives log file for the time period showing the result from zowe as to how it handled this error?

  • Verified Answer

    0   in reply to   

    I have tested this here and have not been able to recreate your situation.
    Each time it works fine and returns JSON:

    {
    "message": "CMN3000I - STEV001659 change package has been frozen.",
    "reasonCode": "3000",
    "returnCode": "00"
    }

    It might seem that something environmental is going on especially with you saying that this has been working fine up until the past week. In order to assist with this, we will need to see exactly what is being returned from zowe 
    You may need to turn on the environment variable for zowe 

    Environment Variable Description Values Default
    ZOWE_APP_LOG_LEVEL Zowe CLI logging level Log4JS log levels (OFF, TRACE, DEBUG, INFO, WARN, ERROR, FATAL) WARN
    ZOWE_IMPERATIVE_LOG_LEVEL Imperative CLI Framework logging level Log4JS log levels (OFF, TRACE, DEBUG, INFO, WARN, ERROR, FATAL) WARN


     
    Set these to TRACE and then delete your imperative log file
    Then you should start your Command line session and issue the command.

    After issue just the one command you can then delete the Environment variables.

    Go into the log and scroll to the bottom and it should show the returned zowe data and give an indication as o to why it is failing. 

  • 0 in reply to   

    Hi Davis,

    I've set these Variables already to ALL.

    This is the Output of the zowe imperative.log in the .zowe Folder:

    zowe.log
    
    [2024/07/09 08:34:34.273] [TRACE] [DaemonClient.js:54] daemon client connected
    [2024/07/09 08:34:34.275] [TRACE] [DaemonClient.js:201] daemon input command: zmf freeze pkg -p BK# 014585 --zmf-profile zmfREST --rfj
    [2024/07/09 08:34:34.470] [DEBUG] [CommonRest.js:89] CommonRest -createPayload package=BK%23%20014585&jobCard01=%2F%2FZOWEJOBN%20JOB%20(RZ)%2CMSGCLASS%3DX%2CMSGLEVEL%3D(1%2C1)%2CCLASS%3DU%2C&jobCard02=%2F%2F%20%20%20%20%20%20%20%20%20%20%20%20%20REGION%3D0M%2CSYSAFF%3DTST1%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20&jobCard03=%2F%2F%20%20%20%20%20%20%20%20%20%20%20%20%20NOTIFY%3D%26SYSUID.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20&jobCard04=%2F%2F*%20GENERATED%20FROM%20ZOWE%20ZMF%20CLI%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
    [2024/07/09 08:34:34.502] [ERROR] [CommonToken.js:26] Fatal error occurred
    Unexpected token < in JSON at position 0
    
    SyntaxError: Unexpected token < in JSON at position 0
    [2024/07/09 08:34:34.521] [TRACE] [DaemonClient.js:65] daemon client disconnected
    [2024/07/09 08:34:34.522] [TRACE] [DaemonClient.js:73] client closed
    
    
    imperative.log (whole log, except command definitions)
    
    [2024/07/09 08:34:34.323] [DEBUG] [CommandYargs.js:76] Defining command: package
    [2024/07/09 08:34:34.328] [DEBUG] [CommandYargs.js:175] Building positional string from: package
    [2024/07/09 08:34:34.331] [DEBUG] [CommandYargs.js:181] Positional String: 
    [2024/07/09 08:34:34.337] [DEBUG] [CommandYargs.js:95] Defining command builder for: package
    [2024/07/09 08:34:34.342] [DEBUG] [CommandYargs.js:106] Handler invoked for: package
    [2024/07/09 08:34:34.344] [DEBUG] [CommandYargs.js:119] Executing Handlers: package
    [2024/07/09 08:34:34.352] [DEBUG] [CommandYargs.js:137] Executing Handlers (1 total)
    [2024/07/09 08:34:34.380] [INFO] [CommandProcessor.js:265] Invoking command "package"...
    [2024/07/09 08:34:34.382] [INFO] [CommandProcessor.js:266] Command issued:
    
    zowe zmf freeze pkg -p BK# 014585 --zmf-profile zmfREST --rfj
    
    
    [2024/07/09 08:34:34.384] [TRACE] [CommandProcessor.js:267] Invoke parameters:
    {
      arguments: {
        _: [ 'zmf', 'freeze', 'pkg' ],
        p: 'BK# 014585',
        package: 'BK# 014585',
        'zmf-profile': 'zmfREST',
        'zmf-p': 'zmfREST',
        zmfP: 'zmfREST',
        zmfProfile: 'zmfREST',
        rfj: true,
        'response-format-json': true,
        responseFormatJson: true,
        version: undefined,
        V: undefined,
        'available-commands': undefined,
        ac: undefined,
        availableCommands: undefined,
        help: undefined,
        h: undefined,
        'help-web': undefined,
        hw: undefined,
        helpWeb: undefined,
        'help-examples': undefined,
        helpExamples: undefined,
        'show-inputs-only': undefined,
        showInputsOnly: undefined,
        'reject-unauthorized': undefined,
        ru: undefined,
        rejectUnauthorized: undefined,
        '$0': 'S:\\software\\fnm\\multishells\\node_modules\\@zowe\\cli\\lib\\main.js'
      },
      silent: false,
      responseFormat: 'json'
    }
    [2024/07/09 08:34:34.387] [TRACE] [CommandProcessor.js:838] Constructing response object for "package" command...
    [2024/07/09 08:34:34.413] [INFO] [DefaultCredentialManager.js:172] Successfully loaded secure value for service = 'Zowe' account = 'secure_config_props'
    [2024/07/09 08:34:34.416] [INFO] [CommandProcessor.js:301] Preparing (loading profiles, reading stdin, etc.) execution of "package" command...
    [2024/07/09 08:34:34.417] [TRACE] [CommandProcessor.js:703] Base set of arguments from Yargs parse:
    {
      _: [ 'zmf', 'freeze', 'pkg' ],
      p: 'BK# 014585',
      package: 'BK# 014585',
      'zmf-profile': 'zmfREST',
      'zmf-p': 'zmfREST',
      zmfP: 'zmfREST',
      zmfProfile: 'zmfREST',
      rfj: true,
      'response-format-json': true,
      responseFormatJson: true,
      '$0': 'S:\\software\\fnm\\multishells\\node_modules\\@zowe\\cli\\lib\\main.js'
    }
    [2024/07/09 08:34:34.420] [TRACE] [CommandProcessor.js:711] Arguments extracted from :
    {
      _: [ 'zmf', 'freeze', 'pkg' ],
      p: 'BK# 014585',
      package: 'BK# 014585',
      'zmf-profile': 'zmfREST',
      'zmf-p': 'zmfREST',
      zmfP: 'zmfREST',
      zmfProfile: 'zmfREST',
      rfj: true,
      'response-format-json': true,
      responseFormatJson: true,
      '$0': 'S:\\software\\fnm\\multishells\\node_modules\\@zowe\\cli\\lib\\main.js'
    }
    [2024/07/09 08:34:34.421] [TRACE] [CommandProcessor.js:713] Arguments merged :
    {
      _: [ 'zmf', 'freeze', 'pkg' ],
      p: 'BK# 014585',
      package: 'BK# 014585',
      'zmf-profile': 'zmfREST',
      'zmf-p': 'zmfREST',
      zmfP: 'zmfREST',
      zmfProfile: 'zmfREST',
      rfj: true,
      'response-format-json': true,
      responseFormatJson: true,
      '$0': 'S:\\software\\fnm\\multishells\\node_modules\\@zowe\\cli\\lib\\main.js'
    }
    [2024/07/09 08:34:34.422] [TRACE] [CommandProcessor.js:715] Reading stdin for "package" command...
    [2024/07/09 08:34:34.424] [DEBUG] [SharedOptions.js:61] Standard input reading not requested. Skipping stdin read
    [2024/07/09 08:34:34.429] [TRACE] [CommandProcessor.js:774] Arguments extracted from the config:
    {
      host: 'ZMFREST-URL',
      rejectUnauthorized: false,
      user: 'USER',
      password: 'PASSWORD',
      port: PORT,
      basePath: '/zmfrest',
      encoding: 'IBM-1141',
      protocol: 'https',
      jobcard01: '//ZOWEJOBN JOB (RZ),MSGCLASS=X,MSGLEVEL=(1,1),CLASS=U,',
      jobcard02: '//             REGION=0M,SYSAFF=TST1,                 ',
      jobcard03: '//             NOTIFY=&SYSUID.                        ',
      jobcard04: '//* GENERATED FROM ZOWE ZMF CLI                       ',
      jc1: '//ZOWEJOBN JOB (RZ),MSGCLASS=X,MSGLEVEL=(1,1),CLASS=U,',
      jc2: '//             REGION=0M,SYSAFF=TST1,                 ',
      jc3: '//             NOTIFY=&SYSUID.                        ',
      jc4: '//* GENERATED FROM ZOWE ZMF CLI                       ',
      'base-path': '/zmfrest',
      bp: '/zmfrest',
      pr: 'https',
      H: 'ZMFREST-URL',
      P: PORT,
      u: 'USER',
      pass: 'PASSWORD',
      pw: 'PASSWORD',
      'reject-unauthorized': false,
      ru: false
    }
    [2024/07/09 08:34:34.430] [TRACE] [CommandProcessor.js:777] Loading profiles for "package" command. Profile definitions: { required: [ 'zmf' ], optional: [ 'base' ] }
    [2024/07/09 08:34:34.431] [TRACE] [CommandProfileLoader.js:53] Profile loader created for command: package
    [2024/07/09 08:34:34.433] [INFO] [CommandProfileLoader.js:83] Request to load profiles for command: package...
    [2024/07/09 08:34:34.434] [TRACE] [CommandProfileLoader.js:84] Profile load arguments supplied:
    {
      host: 'ZMFREST-URL',
      rejectUnauthorized: false,
      user: 'USER',
      password: 'PASSWORD',
      port: PORT,
      basePath: '/zmfrest',
      encoding: 'IBM-1141',
      protocol: 'https',
      jobcard01: '//ZOWEJOBN JOB (RZ),MSGCLASS=X,MSGLEVEL=(1,1),CLASS=U,',
      jobcard02: '//             REGION=0M,SYSAFF=TST1,                 ',
      jobcard03: '//             NOTIFY=&SYSUID.                        ',
      jobcard04: '//* GENERATED FROM ZOWE ZMF CLI                       ',
      jc1: '//ZOWEJOBN JOB (RZ),MSGCLASS=X,MSGLEVEL=(1,1),CLASS=U,',
      jc2: '//             REGION=0M,SYSAFF=TST1,                 ',
      jc3: '//             NOTIFY=&SYSUID.                        ',
      jc4: '//* GENERATED FROM ZOWE ZMF CLI                       ',
      'base-path': '/zmfrest',
      bp: '/zmfrest',
      pr: 'https',
      H: 'ZMFREST-URL',
      P: PORT,
      u: 'USER',
      pass: 'PASSWORD',
      pw: 'PASSWORD',
      'reject-unauthorized': false,
      ru: false,
      _: [ 'zmf', 'freeze', 'pkg' ],
      p: 'BK# 014585',
      package: 'BK# 014585',
      'zmf-profile': 'zmfREST',
      'zmf-p': 'zmfREST',
      zmfP: 'zmfREST',
      zmfProfile: 'zmfREST',
      rfj: true,
      'response-format-json': true,
      responseFormatJson: true,
      '$0': 'S:\\software\\fnm\\multishells\\node_modules\\@zowe\\cli\\lib\\main.js'
    }
    [2024/07/09 08:34:34.434] [TRACE] [CommandProcessor.js:783] Profiles loaded for "package" command:
    CommandProfiles { mMetaMap: Map(0) {}, mMap: Map(0) {} }
    [2024/07/09 08:34:34.436] [TRACE] [CommandProcessor.js:799] Arguments extract from the profile:
    {}
    [2024/07/09 08:34:34.437] [TRACE] [CommandProcessor.js:814] Full argument object constructed:
    {
      host: 'ZMFREST-URL',
      rejectUnauthorized: false,
      user: 'USER',
      password: 'PASSWORD',
      port: PORT,
      basePath: '/zmfrest',
      encoding: 'IBM-1141',
      protocol: 'https',
      jobcard01: '//ZOWEJOBN JOB (RZ),MSGCLASS=X,MSGLEVEL=(1,1),CLASS=U,',
      jobcard02: '//             REGION=0M,SYSAFF=TST1,                 ',
      jobcard03: '//             NOTIFY=&SYSUID.                        ',
      jobcard04: '//* GENERATED FROM ZOWE ZMF CLI                       ',
      jc1: '//ZOWEJOBN JOB (RZ),MSGCLASS=X,MSGLEVEL=(1,1),CLASS=U,',
      jc2: '//             REGION=0M,SYSAFF=TST1,                 ',
      jc3: '//             NOTIFY=&SYSUID.                        ',
      jc4: '//* GENERATED FROM ZOWE ZMF CLI                       ',
      'base-path': '/zmfrest',
      bp: '/zmfrest',
      pr: 'https',
      H: 'ZMFREST-URL',
      P: PORT,
      u: 'USER',
      pass: 'PASSWORD',
      pw: 'PASSWORD',
      'reject-unauthorized': false,
      ru: false,
      _: [ 'zmf', 'freeze', 'pkg' ],
      p: 'BK# 014585',
      package: 'BK# 014585',
      'zmf-profile': 'zmfREST',
      'zmf-p': 'zmfREST',
      zmfP: 'zmfREST',
      zmfProfile: 'zmfREST',
      rfj: true,
      'response-format-json': true,
      responseFormatJson: true,
      '$0': 'S:\\software\\fnm\\multishells\\node_modules\\@zowe\\cli\\lib\\main.js'
    }
    [2024/07/09 08:34:34.437] [TRACE] [CommandProcessor.js:838] Constructing response object for "package" command...
    [2024/07/09 08:34:34.440] [INFO] [CommandProcessor.js:210] Performing syntax validation for command "package"...
    [2024/07/09 08:34:34.441] [TRACE] [SyntaxValidator.js:115] no unknown positionals. Length of positional arguments was: %s. Contents of _ were %s, Expected "_" to have length of %s
    [2024/07/09 08:34:34.443] [INFO] [CommandProcessor.js:461] Invoking process method of handler for "package" command.
    [2024/07/09 08:34:34.446] [INFO] [CommandProcessor.js:865] Requiring handler "C:\users\ris0186\.zowe\plugins\installed\node_modules\@microfocus\zmf-cli-plugin\lib\cli\freeze\packageFreeze/PackageFreeze.handler" for command "C:\users\ris0186\.zowe\plugins\installed\node_modules\@microfocus\zmf-cli-plugin\lib\cli\freeze\packageFreeze/PackageFreeze.handler"...
    [2024/07/09 08:34:34.455] [INFO] [CommandProcessor.js:868] Handler "C:\users\ris0186\.zowe\plugins\installed\node_modules\@microfocus\zmf-cli-plugin\lib\cli\freeze\packageFreeze/PackageFreeze.handler" for command "package" successfully loaded/required.
    [2024/07/09 08:34:34.463] [DEBUG] [ConnectionPropsForSessCfg.js:276] Using basic authentication
    [2024/07/09 08:34:34.465] [DEBUG] [ConnectionPropsForSessCfg.js:400] Creating a session config with these properties:
    {
      "rejectUnauthorized": false,
      "basePath": "/zmfrest",
      "protocol": "https",
      "hostname": "ZMFREST-URL",
      "port": PORT,
      "user": "user_is_hidden",
      "password": "password_is_hidden",
      "type": "basic"
    }
    [2024/07/09 08:34:34.466] [DEBUG] [ConnectionPropsForSessCfg.js:159] Session config after any prompting for missing values:
    [2024/07/09 08:34:34.467] [DEBUG] [ConnectionPropsForSessCfg.js:400] Creating a session config with these properties:
    {
      "rejectUnauthorized": false,
      "basePath": "/zmfrest",
      "protocol": "https",
      "hostname": "ZMFREST-URL",
      "port": PORT,
      "user": "user_is_hidden",
      "password": "password_is_hidden",
      "type": "basic"
    }
    [2024/07/09 08:34:34.471] [TRACE] [AbstractRestClient.js:302] Using basic authentication
    [2024/07/09 08:34:34.472] [TRACE] [AbstractRestClient.js:637] appendInputHeaders called with options on rest client {"headers":{"Authorization":"Basic VUJSQUY6RkVMSVgwMTY="},"hostname":"ZMFREST-URL","method":"PUT","path":"/zmfrest/package/freeze","port":443,"rejectUnauthorized":false} RestClient
    [2024/07/09 08:34:34.473] [TRACE] [AbstractRestClient.js:363] Rest request: PUT ZMFREST-URL:443/zmfrest/package/freeze as user USER
    [2024/07/09 08:34:34.476] [DEBUG] [AbstractRestClient.js:139] will write data for request
    [2024/07/09 08:34:34.497] [DEBUG] [AbstractRestClient.js:389] Content length of response is: 247
    [2024/07/09 08:34:34.498] [TRACE] [AbstractRestClient.js:440] Data chunk received...
    [2024/07/09 08:34:34.500] [DEBUG] [AbstractRestClient.js:482] onEnd() called for rest client RestClient
    [2024/07/09 08:34:34.503] [ERROR] [CommandProcessor.js:932] Handler for command "package" failed.
    [2024/07/09 08:34:34.505] [ERROR] [CommandProcessor.js:935] Diagnostic information:
    Platform: 'win32', Architecture: 'x64', Process.argv: 'S:\software\fnm\multishells\node.exe S:\software\fnm\multishells\node_modules\@zowe\cli\lib\main.js --daemon'
    Node versions: '{
      "node": "18.12.0",
      "v8": "10.2.154.15-node.12",
      "uv": "1.43.0",
      "zlib": "1.2.11",
      "brotli": "1.0.9",
      "ares": "1.18.1",
      "modules": "108",
      "nghttp2": "1.47.0",
      "napi": "8",
      "llhttp": "6.0.10",
      "openssl": "3.0.5+quic",
      "cldr": "41.0",
      "icu": "71.1",
      "tz": "2022b",
      "unicode": "14.0",
      "ngtcp2": "0.8.1",
      "nghttp3": "0.7.0"
    }'Environmental variables: '{
      ...
      "FNM_ARCH": "x64",
      "FNM_DIR": "S:\\software\\fnm",
      "FNM_LOGLEVEL": "info",
      "FNM_MULTISHELL_PATH": "S:\\software\\fnm\\multishells",
      "FNM_NODE_DIST_MIRROR": "https://nodejs.org/dist",
      "FNM_VERSION_FILE_STRATEGY": "local",
      ...
      "ZOWE_APP_LOG_LEVEL": "ALL",
      "ZOWE_CLI_HOME": "C:\\users\\ris0186\\.zowe",
      "ZOWE_IMPERATIVE_LOG_LEVEL": "ALL"
    }'
    [2024/07/09 08:34:34.508] [ERROR] [CommandProcessor.js:943] Handler for package rejected by thrown ImperativeError.
    [2024/07/09 08:34:34.515] [INFO] [CommandProcessor.js:919] Command "package" completed with success flag: "false"
    [2024/07/09 08:34:34.516] [TRACE] [CommandProcessor.js:920] Command "package" finished. Response object:
    {
      success: false,
      exitCode: 1,
      message: 'The put request appeared to succeed, but the response was not in the expected format:\n' +
        'Unexpected token < in JSON at position 0',
      stdout: <Buffer >,
      stderr: <Buffer 43 6f 6d 6d 61 6e 64 20 45 72 72 6f 72 3a 0a 54 68 65 20 70 75 74 20 72 65 71 75 65 73 74 20 61 70 70 65 61 72 65 64 20 74 6f 20 73 75 63 63 65 65 64 ... 148 more bytes>,
      data: {},
      error: {
        msg: 'The put request appeared to succeed, but the response was not in the expected format:\n' +
          'Unexpected token < in JSON at position 0',
        stack: 'SyntaxError: Unexpected token < in JSON at position 0\n' +
          '    at JSON.parse (<anonymous>)\n' +
          '    at JSONUtils.parse (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\utilities\\src\\JSONUtils.js:42:29)\n' +
          '    at RestClient.<anonymous> (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\rest\\src\\client\\RestClient.js:70:42)\n' +
          '    at Generator.next (<anonymous>)\n' +
          '    at fulfilled (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\rest\\src\\client\\RestClient.js:15:58)\n' +
          '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
        additionalDetails: 'Unexpected token < in JSON at position 0',
        causeErrors: SyntaxError: Unexpected token < in JSON at position 0
            at JSON.parse (<anonymous>)
            at JSONUtils.parse (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\utilities\src\JSONUtils.js:42:29)
            at RestClient.<anonymous> (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\rest\src\client\RestClient.js:70:42)
            at Generator.next (<anonymous>)
            at fulfilled (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\rest\src\client\RestClient.js:15:58)
            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      }
    }
    [2024/07/09 08:34:34.518] [ERROR] [CommandYargs.js:148] Error in command package
    [2024/07/09 08:34:34.520] [ERROR] [CommandYargs.js:149] [
      {
        success: false,
        exitCode: 1,
        message: 'The put request appeared to succeed, but the response was not in the expected format:\n' +
          'Unexpected token < in JSON at position 0',
        stdout: <Buffer >,
        stderr: <Buffer 43 6f 6d 6d 61 6e 64 20 45 72 72 6f 72 3a 0a 54 68 65 20 70 75 74 20 72 65 71 75 65 73 74 20 61 70 70 65 61 72 65 64 20 74 6f 20 73 75 63 63 65 65 64 ... 148 more bytes>,
        data: {},
        error: {
          msg: 'The put request appeared to succeed, but the response was not in the expected format:\n' +
            'Unexpected token < in JSON at position 0',
          stack: 'SyntaxError: Unexpected token < in JSON at position 0\n' +
            '    at JSON.parse (<anonymous>)\n' +
            '    at JSONUtils.parse (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\utilities\\src\\JSONUtils.js:42:29)\n' +
            '    at RestClient.<anonymous> (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\rest\\src\\client\\RestClient.js:70:42)\n' +
            '    at Generator.next (<anonymous>)\n' +
            '    at fulfilled (S:\\software\\fnm\\node-versions\\v18.12.0\\installation\\node_modules\\@zowe\\cli\\node_modules\\@zowe\\imperative\\lib\\rest\\src\\client\\RestClient.js:15:58)\n' +
            '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
          additionalDetails: 'Unexpected token < in JSON at position 0',
          causeErrors: SyntaxError: Unexpected token < in JSON at position 0
              at JSON.parse (<anonymous>)
              at JSONUtils.parse (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\utilities\src\JSONUtils.js:42:29)
              at RestClient.<anonymous> (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\rest\src\client\RestClient.js:70:42)
              at Generator.next (<anonymous>)
              at fulfilled (S:\software\fnm\node-versions\v18.12.0\installation\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\rest\src\client\RestClient.js:15:58)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        }
      }
    ]
    
    This is almost the whole log except some Command definitions and some Environment Variables which are not related to zowe or zmf

  • 0   in reply to 

    It appears that you are running zowe cli in Daemon mode.

    Also you have —rfj defined on the command line.

    Can you try not running in Daemon mode just to rule that out.

    Also try removing the —rfj option as the output from the CLI command is already in json format so should not  need that command option to be specified .  

  • 0 in reply to   


    does not change anything about the response. Neither disabling the daemon nor removing --rfj

  • 0   in reply to 

    Can you confirm if the freeze actually completed auccessfully and it is the returned response that is failing- or did the freeze itself fail?

    Also - still need to see what the errors that you get when you try the URL call in Python in case it sheds any more light on the problem.