#3968·kubescape

Metrics endpoint: failed read results from file. reason: open results no such file or directory

Author: BroderPetersCreated Sep 28, 2026Updated Sep 28, 2026
Labelsbug

Description

Calling kubescape using curl -sS "http://10.0.0.77:8080/v1/metrics?skipPersistence=true&frameworks=nsa" (Calling without frameworks parameter results into this known bug) results into the following logs in kubescape

bash
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"requesting scan","scanID":"f8b37efb-7316-43a6-8562-bcde78ee3d24","api":"v1/metrics"}
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"triggering scan","scanID":"f8b37efb-7316-43a6-8562-bcde78ee3d24"}
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"scan triggered","ID":"f8b37efb-7316-43a6-8562-bcde78ee3d24"}
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"Kubescape scanner initializing..."}
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"Initialized scanner"}
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"Loading policies..."}
{"level":"debug","ts":"2026-09-28T13:59:53Z","msg":"Downloading framework","framework":"nsa"}
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"Loaded policies"}
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"Loading exceptions..."}
{"level":"warn","ts":"2026-09-28T13:59:53Z","msg":"failed to get CRD security exceptions; continuing with primary exceptions only","error":"failed to list securityexceptions CRDs: securityexceptions.kubescape.io is forbidden: User \"system:serviceaccount:kubescape:kubescape\" cannot list resource \"securityexceptions
\" in API group \"kubescape.io\" at the cluster scope"}
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"Loaded exceptions"}
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"Loading account configurations..."}
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"Loaded account configurations"}
{"level":"info","ts":"2026-09-28T13:59:53Z","msg":"Accessing Kubernetes objects..."}
[...]
{"level":"info","ts":"2026-09-28T13:59:58Z","msg":"Scan results saved","filename":"results/f8b37efb-7316-43a6-8562-bcde78ee3d24.txt"}
{"level":"info","ts":"2026-09-28T13:59:58Z","msg":"skipPersistence=true, skipping storing results"}
{"level":"info","ts":"2026-09-28T13:59:58Z","msg":"done scanning","ID":"f8b37efb-7316-43a6-8562-bcde78ee3d24"}
(END)

and an error code on the curl call:

bash
{"id":"f8b37efb-7316-43a6-8562-bcde78ee3d24","type":"error","response":"failed read results from file. reason: open results/f8b37efb-7316-43a6-8562-bcde78ee3d24: no such file or directory"}

It feels like the .txt file extension is missing upon calling the results file.

Environment

OS: v1.37.0+k3s1, Ubuntu 24.04 Version: kubescape v4.0.13, operator 1.40.4

Steps To Reproduce

  1. helm values
yaml
clusterName: "cluster.local"
defaultFrameworks:
  - nsa
grypeOfflineDB:
  enabled: true
  image:
    tag: v6-latest
configurations:
  prometheusAnnotations: enable
kubescape:
  downloadArtifacts: false
  skipUpdateCheck: true
  serviceMonitor:
    enabled: true
    skipPersistence: true
    interval: 1h
    scrapeTimeout: 4m
    additionalLabels:
      release: prometheus-stack

prometheusExporter:
  enableWorkloadMetrics: true
  serviceMonitor:
    enabled: true

persistence:
  storageClass: "ceph-block"

global:
  networkPolicy:
    enabled: true
  overrideRuntimePath: "/host/var/lib/rancher/k3s/data/current/bin/runc"

capabilities:
  continuousScan: enable
  relevancy: enable
  kubescapeOffline: enable
  nodeProfileService: disable
  networkEventsStreaming: disable
  runtimeDetection: enable

nodeAgent:
  config:
    hostSensor:
      enabled: false
  serviceMonitor:
    enabled: true

kubevuln:
  config:
    proxyRegistryMap:
[...]

logger:
  level: debug
  1. helm install: helm upgrade --install kubescape kubescape/kubescape-operator -n kubescape --create-namespace --version 1.40.4 -f k8s/base/kubescape/values.kubescape.yaml
  2. Call the metrics endpoint via service monitor or curl -sS "http://10.0.0.77:8080/v1/metrics?skipPersistence=true&frameworks=nsa"
  3. Get specified error

Expected behavior

Prometheus metrics are received without error

Actual Behavior

failed read results from file. reason: open results/f8b37efb-7316-43a6-8562-bcde78ee3d24: no such file or directory

Additional context

Calling over the POST scan endpoint (suggested by Claude) works:

bash
curl -sS -X POST "http://10.0.0.77:8080/v1/scan?wait=true&skipPersistence=true"   -H "Content-Type: application/json"   -d '{"format": "prometheus", "targetType": "framework", "targetNames": ["nsa"]}'
{"id":"37c387db-84ef-4f0e-8ba3-f4cbf2f9a78d","type":"v1results","response":{"generationTime":"2026-09-28T14:17:50.868103513Z","clusterAPIServerInfo":{"major":"1","minor":"37","emulationMajor":"1","emulationMinor":"37","minCompatibilityMajor":"1","minCompatibilityMinor":"36","gitVersion":"v1.37.0+k3s1","gitCommit":"bb7cf0657bafdfbb4349d1740810442d09c2248a","gitTreeState":"clean","buildDate":"2026-09-14T15:44:46Z","goVersion":"go1.26.7","compiler":"gc","platform":"linux/amd64"},"clusterCloudProvider":"","customerGUID":"","clusterName":"cluster-local","reportGUID":"37c387db-84ef-4f0e-8ba3-f4cbf2f9a78d","jobID":"",[...]