sgl-project/sglang · error · NotImplementedError

manually start is only supported yet

Error message

manually start is only supported yet

What it means

The profiler wrapper's manual_start is a stub — only the automatic (request/stage-triggered) start path is implemented. Calling manual_start raises NotImplementedError, signalling an unimplemented feature rather than misuse.

Source

Thrown at python/sglang/srt/utils/profile_utils.py:139

        self.profiler_kwargs = dict(
            activities=activities,
            with_stack=with_stack,
            record_shapes=record_shapes,
            output_dir=output_dir,
            output_prefix=profile_prefix,
            profile_id=profile_id,
        )

        self.stage_based_trigger.configure(
            num_steps=num_steps,
            interesting_stages=profile_stages or ["prefill", "decode"],
        )

        return ProfileReqOutput(success=True, message="Succeeded")

    def manual_start(self):
        raise NotImplementedError("manually start is only supported yet")

    def manual_stop(self):
        raise NotImplementedError("manually stop is only supported yet")

    def _do_start(self, stage: Optional[str] = None):
        logger.info(
            f"Profiling starts{f' for {stage}' if stage else ''}. "
            f"Traces will be saved to: {self.profiler_kwargs['output_dir']} "
            f"(with profile id: {self.profiler_kwargs['profile_id']})",
        )

        assert self.profiler is None
        # Fold the per-phase c_/g_ aggregates into the step span while this
        # stage's profile is active (v2 auto-start path; reset in _do_stop).
        set_detailed_annotations_enabled(self.detailed_annotations)
        self.profiler = _ProfilerBase.create(
            **self.profiler_kwargs,
            ps=self.ps,

View on GitHub (pinned to 0132848349)

Solutions

  1. Use the automatic start mode / default _start_profile flow instead of manual start
  2. Update sglang — check release notes for when manual start becomes available
  3. Guard API clients: catch NotImplementedError and fall back to auto profiling

Example fix

# before
profiler.manual_start()
# after
result = await profiler.start(...)  # automatic trigger path
Defensive patterns

Strategy: fallback

Validate before calling

import inspect
assert not isinstance(getattr(profiler, 'manual_start', None), type(NotImplementedError)) or True
# simplest: feature check
feature_ok = profiler.manual_start.__code__.co_names == () or True

Type guard

null

Try / catch

try:
    profiler.manual_start()
except NotImplementedError:
    await profiler.start(...)  # automatic path

Prevention

When it happens

Trigger: A /start_profile API request with a 'manual' start mode (or calling manual_start directly) reaching this stub profiler implementation.

Common situations: Tooling or scripts assuming a manual start/stop profiling session is supported; API clients passing manual start flags not yet honored.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/42d037b25a7bebc4. Report an issue: GitHub.