Tencent/WeKnora · error

invalid OBS file path: %s

Error message

invalid OBS file path: %s

What it means

OBS path parser guard: the path matched the service prefix but no object key could be extracted — under a proxy domain the remainder was empty, or without one the bucket/key segments were missing/blank — so the path is malformed and rejected before any storage call.

Source

Thrown at internal/application/service/file/obs.go:131

	})
	if err != nil {
		return fmt.Errorf("OBS connectivity check failed: %w", err)
	}
	return nil
}

func (s *obsFileService) parseObsFilePath(filePath string) (string, error) {
	prefix := s.getPrifix()

	if strings.HasPrefix(filePath, prefix) {
		rest := strings.TrimPrefix(filePath, prefix)
		// With proxy domain: path is {prefix}/{objectKey} (no bucket name)
		if s.proxyDomain != "" {
			rest = strings.TrimPrefix(rest, "/")
			if rest != "" {
				return rest, nil
			}
			return "", fmt.Errorf("invalid OBS file path: %s", filePath)
		}
		// Without proxy domain: path is {prefix}/{bucketName}/{objectKey}
		parts := strings.SplitN(rest, "/", 2)
		if len(parts) == 2 && parts[0] == s.bucketName && parts[1] != "" {
			return parts[1], nil
		}
		return "", fmt.Errorf("invalid OBS file path: %s", filePath)
	}
	return filePath, nil
}

func (s *obsFileService) getPrifix() string {
	if s.proxyDomain != "" {
		return s.proxyDomain + "/"
	}
	return "obs://"
}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Use paths exactly as returned by the OBS SaveFile/SaveBytes helpers
  2. Verify proxy-domain configuration matches the path format
  3. Validate path shape at ingestion
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/application/service/file/obs.go:131 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/85d25862c357b37f. Report an issue: GitHub.