An upgrade fails with error "The token expired, was revoked, or the token ID is incorrect"


Upgrading a deployment from a prior version of SAS® Visual Investigator to SAS® Visual Investigator 10.8 might fail with the following error:

 TASK [sviconfig-x64_redhat_linux_6-yum : Execute svi-configuration_execute_wrapper_script]

****************************************************************************

task path: /opt/upgrade/sas_viya_playbook/roles/sviconfig-x64_redhat_linux_6-yum/tasks/start.yml:12

fatal: [deployTarget]: FAILED! =>

{

  "changed": true,

  "cmd": ["bash", "-c", "chmod +x /opt/sas/viya/home/share/svi-configuration/svi-configuration-wrapper.sh; cd /opt/sas/viya/home/share/svi-configuration; /opt/sas/viya/home/share/svi-configuration/svi-configuration-wrapper.sh --sashome /opt/sas/viya/home --sasconfig /opt/sas/viya/config --instanceid default --consulhost 10.104.88.8 --httpproxy your.hostname.com "],

  "delta": "0:00:03.084313",

  "end": "2025-06-06 10:51:12.442079",

  "msg": "non-zero return code",

  "rc": 1,

  "start": "2025-06-06 10:51:09.357766",

  "stderr_lines": [

    " % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current",

    " Dload  Upload   Total   Spent    Left  Speed",

    "",

    "  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0",

    "100   109    0   109    0     0    126      0 --:--:-- --:--:-- --:--:--   126",

    "100   109    0   109    0     0    126      0 --:--:-- --:--:-- --:--:--   126",

    "[2025-06-06 10:51:12] [ERROR] /opt/sas/viya/home/share/svi-configuration/svi-configuration-functions.sh exited with return code 1"

  ],

  "stdout_lines": [

    "[2025-06-06 10:51:10] [INFO] Obtaining SASLogon token for admin user deletion. Attempt #1",

    "[2025-06-06 10:51:11] [INFO] Status code: 200",

    "{\"error\":\"invalid_token\",\"error_description\":\"The token expired, was revoked, or the token ID is incorrect.\"}

    "[2025-06-06 10:51:12] [FATAL] Admin credentials still exist"

  ]

}

NO MORE HOSTS LEFT

This error occurs because the deletion of the admin user failed. The admin user name is wrapped in double quotes, which is the root cause of this error.

Workaround

To circumvent this issue, edit the /opt/sas/viya/home/share/svi-configuration/svi-configuration-function.sh script and rerun the playbook.

Change line 255 as follows:

Original:

      user_create_access_token=$(echo "$user_create_access_body" | ${JQ_CMD} ".access_token") || return

New:

      user_create_access_token=$(echo "$user_create_access_body" | ${JQ_CMD} -r ".access_token") || return