Job fails immediately after executing pipeline

My self-hosted runner on Windows PowerShell often fails job immediately after executing pipeline. I haven’t tried on the other Windows devices. Saas dockerr runner never fails like this.
I googled, but no similar cases are found… I appreciate any hints.

Problem to solve

The failure log is as below:

Running with gitlab-runner 16.11.1 (535ced5f)
  on test j7r8KZy2z, system ID: s_20182346aa2a
Preparing the "shell" executor
Using Shell (powershell) executor...
Preparing environment
Running on _MYUSERNAME...
Getting source from Git repository
At line:262 char:45
+                                             ~~~~~~
Unexpected token 'false"
$CI_RUNNER_TAGS="[`"ue4`"' in expression or statement.
At line:282 char:26
+ $CI_RUNNER_TAGS="[`"ue4`", `"windows`"]"
+                          ~
Missing argument in parameter list.
At line:315 char:7
+ & "git" 'config' '-f' 'C:\GitLab-Runner\builds\j7r8KZy2z\0\_MYREPOSITORY ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The string is missing the terminator: ".
At line:1 char:3
+ & {
+   ~
Missing closing '}' in statement block or type definition.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken
error: could not lock config file C:\GitLab-Runner\builds\j7r8KZy2z\0\_MYREPOSITORY.tmp\git-template\config: No such file or directory
Cleaning up project directory and file based variables
ERROR: Job failed: exit status 255

I am suspecting that the Gitlab’s system itself is the culprit because the error occurred right after calling the job.
I reregistered some times, but got no effects.


  • config.tmol

    concurrent = 1
    check_interval = 0
    connection_max_age = "15m0s"
    shutdown_timeout = 0
      session_timeout = 1800
      name = "test"
      url = ""
      id = 37534344
      token = "*****************************"
      token_obtained_at = 2024-06-02T07:00:10Z
      token_expires_at = 0001-01-01T00:00:00Z
      executor = "shell"
      shell = "powershell"
        MaxUploadedArchiveSize = 0
  • .gitlab-ci.yml

      - prepare
      tags: [windows,ue4]
      interruptible: true
        - $OutputEncoding.EncodingName
        - chcp 65001
      stage: prepare
      tags: [windows,ue4]
        - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
          when: always
        - $OutputEncoding.EncodingName
        - $PSDefaultParameterValues['Out-File:Encoding'] = 'ascii'
        - Write-Output "prepare"


Please select whether options apply, and add the version information.

  • Self-managed
  • SaaS
  • Self-hosted Runners


  • GitLab (Web: /help or self-managed system information):
    Official SaaS Gitlab

  • GitLab Runner

    PS C:\GitLab-Runner> .\gitlab-runner.exe --version
    Version:      16.11.1
    Git revision: 535ced5f
    Git branch:   16-11-stable
    GO version:   go1.21.9
    Built:        2024-05-03T15:52:47+0000
    OS/Arch:      windows/amd64